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:
Tim Janik
1998-12-21 21:43:00 +00:00
committed by Tim Janik
parent 85755f7e77
commit 097c9b1798
14 changed files with 166 additions and 28 deletions

View File

@@ -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;