reentrancy fixups

This commit is contained in:
Tim Janik 1999-01-17 05:03:18 +00:00
parent 08425ac4c2
commit 37f659ec11
4 changed files with 22 additions and 26 deletions

11
ghook.c
View File

@ -131,18 +131,9 @@ g_hook_destroy_link (GHookList *hook_list,
hook->hook_id = 0; hook->hook_id = 0;
hook->flags &= ~G_HOOK_FLAG_ACTIVE; hook->flags &= ~G_HOOK_FLAG_ACTIVE;
if (hook_list->hook_destroy) if (hook_list->hook_destroy)
{
hook_list->hook_destroy (hook_list, hook); hook_list->hook_destroy (hook_list, hook);
hook->destroy = NULL;
}
else if (hook->destroy) else if (hook->destroy)
{ hook->destroy (hook->data);
GDestroyNotify destroy;
destroy = hook->destroy;
hook->destroy = NULL;
destroy (hook->data);
}
g_hook_unref (hook_list, hook); /* counterpart to g_hook_insert_before */ g_hook_unref (hook_list, hook); /* counterpart to g_hook_insert_before */
} }
} }

View File

@ -131,18 +131,9 @@ g_hook_destroy_link (GHookList *hook_list,
hook->hook_id = 0; hook->hook_id = 0;
hook->flags &= ~G_HOOK_FLAG_ACTIVE; hook->flags &= ~G_HOOK_FLAG_ACTIVE;
if (hook_list->hook_destroy) if (hook_list->hook_destroy)
{
hook_list->hook_destroy (hook_list, hook); hook_list->hook_destroy (hook_list, hook);
hook->destroy = NULL;
}
else if (hook->destroy) else if (hook->destroy)
{ hook->destroy (hook->data);
GDestroyNotify destroy;
destroy = hook->destroy;
hook->destroy = NULL;
destroy (hook->data);
}
g_hook_unref (hook_list, hook); /* counterpart to g_hook_insert_before */ g_hook_unref (hook_list, hook); /* counterpart to g_hook_insert_before */
} }
} }

View File

@ -421,6 +421,12 @@ g_source_destroy_func (GHookList *hook_list,
G_LOCK (main_loop); G_LOCK (main_loop);
} }
static void
g_source_noop (GHookList *hook_list,
GHook *hook)
{
}
guint guint
g_source_add (gint priority, g_source_add (gint priority,
gboolean can_recurse, gboolean can_recurse,
@ -437,7 +443,8 @@ g_source_add (gint priority,
if (!source_list.is_setup) if (!source_list.is_setup)
g_hook_list_init (&source_list, sizeof(GSource)); g_hook_list_init (&source_list, sizeof(GSource));
source_list.hook_destroy = g_source_destroy_func; source_list.hook_destroy = g_source_noop;
source_list.hook_free = g_source_destroy_func;
source = (GSource *)g_hook_alloc (&source_list); source = (GSource *)g_hook_alloc (&source_list);
source->priority = priority; source->priority = priority;
@ -1116,7 +1123,7 @@ g_timeout_dispatch (gpointer source_data,
{ {
GTimeoutData *data = source_data; GTimeoutData *data = source_data;
if (data->callback(user_data)) if (data->callback (user_data))
{ {
guint seconds = data->interval / 1000; guint seconds = data->interval / 1000;
guint msecs = data->interval - seconds * 1000; guint msecs = data->interval - seconds * 1000;

11
gmain.c
View File

@ -421,6 +421,12 @@ g_source_destroy_func (GHookList *hook_list,
G_LOCK (main_loop); G_LOCK (main_loop);
} }
static void
g_source_noop (GHookList *hook_list,
GHook *hook)
{
}
guint guint
g_source_add (gint priority, g_source_add (gint priority,
gboolean can_recurse, gboolean can_recurse,
@ -437,7 +443,8 @@ g_source_add (gint priority,
if (!source_list.is_setup) if (!source_list.is_setup)
g_hook_list_init (&source_list, sizeof(GSource)); g_hook_list_init (&source_list, sizeof(GSource));
source_list.hook_destroy = g_source_destroy_func; source_list.hook_destroy = g_source_noop;
source_list.hook_free = g_source_destroy_func;
source = (GSource *)g_hook_alloc (&source_list); source = (GSource *)g_hook_alloc (&source_list);
source->priority = priority; source->priority = priority;
@ -1116,7 +1123,7 @@ g_timeout_dispatch (gpointer source_data,
{ {
GTimeoutData *data = source_data; GTimeoutData *data = source_data;
if (data->callback(user_data)) if (data->callback (user_data))
{ {
guint seconds = data->interval / 1000; guint seconds = data->interval / 1000;
guint msecs = data->interval - seconds * 1000; guint msecs = data->interval - seconds * 1000;