mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-25 02:18:55 +02:00
there was a reference count race for hooks during invocation loops. since
Mon Dec 21 21:48:29 1998 Tim Janik <timj@gtk.org> * glib.h: * gmain.c: there was a reference count race for hooks during invocation loops. since all (known) hook loop implementations, do currently start out with g_hook_first_valid() and iterate with g_hook_next_valid(), g_hook_first_valid() will now return a referenced hook, and g_hook_next_valid() will "eat" that, and eventually transfer it to the next hook. <sigh> unfortunately this requires g_hook_next_valid() to take the hook_list as additional argument. * gmain.c (g_main_iterate): adjusted callers of g_hook_next_valid().
This commit is contained in:
8
gmain.c
8
gmain.c
@@ -474,7 +474,7 @@ g_main_iterate (gboolean block,
|
||||
break;
|
||||
if (G_HOOK_IN_CALL (hook) && !(hook->flags & G_SOURCE_CAN_RECURSE))
|
||||
{
|
||||
hook = g_hook_next_valid (hook, TRUE);
|
||||
hook = g_hook_next_valid (&source_list, hook, TRUE);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -510,7 +510,7 @@ g_main_iterate (gboolean block,
|
||||
timeout = MIN (timeout, source_timeout);
|
||||
}
|
||||
|
||||
tmp = g_hook_next_valid (hook, TRUE);
|
||||
tmp = g_hook_next_valid (&source_list, hook, TRUE);
|
||||
|
||||
g_hook_unref (&source_list, hook);
|
||||
hook = tmp;
|
||||
@@ -534,7 +534,7 @@ g_main_iterate (gboolean block,
|
||||
break;
|
||||
if (G_HOOK_IN_CALL (hook) && !(hook->flags & G_SOURCE_CAN_RECURSE))
|
||||
{
|
||||
hook = g_hook_next_valid (hook, TRUE);
|
||||
hook = g_hook_next_valid (&source_list, hook, TRUE);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -561,7 +561,7 @@ g_main_iterate (gboolean block,
|
||||
}
|
||||
}
|
||||
|
||||
tmp = g_hook_next_valid (hook, TRUE);
|
||||
tmp = g_hook_next_valid (&source_list, hook, TRUE);
|
||||
|
||||
g_hook_unref (&source_list, hook);
|
||||
hook = tmp;
|
||||
|
Reference in New Issue
Block a user