I was going through GHook module of glib when i came across something that i could not understand. There is a funciton g_hook_find_func in which the second parameter when passed not TRUE should search hooks which have also been destroyed. When we call destroy on the hook, the hook_id become 0 if the reference count of the hook is greater than 1. As i see from the code given below taken from glib 2.8.4 a hook is returned only when its id is non zero. So if i call destroy on a hook with reference count > 1 and call g_hook_find_func that hook wont be searched. Can someone please tell me why is it like that or there is something wrong in the way i am trying to do things.
GHook*
g_hook_find_func (GHookList *hook_list,
gboolean need_valids,
gpointer func)
{
GHook *hook;
g_return_val_if_fail (hook_list != NULL, NULL);
g_return_val_if_fail (func != NULL, NULL);
hook = hook_list->hooks;
while (hook)
{
/* test only non-destroyed hooks */
if (hook->func == func &&
hook->hook_id &&
(!need_valids || G_HOOK_ACTIVE (hook)))
return hook;
hook = hook->next;
}
return NULL;
}
Regards,
Sumit Kumar Jain
Love cheap thrills? Enjoy PC-to-Phone calls to 30+ countries for just 2¢/min with Yahoo! Messenger with Voice.
_______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list