From 37f659ec1127781395c3523244399514ba99eab7 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Sun, 17 Jan 1999 05:03:18 +0000 Subject: [PATCH] reentrancy fixups --- ghook.c | 13 ++----------- glib/ghook.c | 13 ++----------- glib/gmain.c | 11 +++++++++-- gmain.c | 11 +++++++++-- 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/ghook.c b/ghook.c index 89c7cfb..4464db4 100644 --- a/ghook.c +++ b/ghook.c @@ -131,18 +131,9 @@ g_hook_destroy_link (GHookList *hook_list, hook->hook_id = 0; hook->flags &= ~G_HOOK_FLAG_ACTIVE; if (hook_list->hook_destroy) - { - hook_list->hook_destroy (hook_list, hook); - hook->destroy = NULL; - } + hook_list->hook_destroy (hook_list, hook); else if (hook->destroy) - { - GDestroyNotify destroy; - - destroy = hook->destroy; - hook->destroy = NULL; - destroy (hook->data); - } + hook->destroy (hook->data); g_hook_unref (hook_list, hook); /* counterpart to g_hook_insert_before */ } } diff --git a/glib/ghook.c b/glib/ghook.c index 89c7cfb..4464db4 100644 --- a/glib/ghook.c +++ b/glib/ghook.c @@ -131,18 +131,9 @@ g_hook_destroy_link (GHookList *hook_list, hook->hook_id = 0; hook->flags &= ~G_HOOK_FLAG_ACTIVE; if (hook_list->hook_destroy) - { - hook_list->hook_destroy (hook_list, hook); - hook->destroy = NULL; - } + hook_list->hook_destroy (hook_list, hook); else if (hook->destroy) - { - GDestroyNotify destroy; - - destroy = hook->destroy; - hook->destroy = NULL; - destroy (hook->data); - } + hook->destroy (hook->data); g_hook_unref (hook_list, hook); /* counterpart to g_hook_insert_before */ } } diff --git a/glib/gmain.c b/glib/gmain.c index 9da4fa0..0bcd51a 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -421,6 +421,12 @@ g_source_destroy_func (GHookList *hook_list, G_LOCK (main_loop); } +static void +g_source_noop (GHookList *hook_list, + GHook *hook) +{ +} + guint g_source_add (gint priority, gboolean can_recurse, @@ -437,7 +443,8 @@ g_source_add (gint priority, if (!source_list.is_setup) 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->priority = priority; @@ -1116,7 +1123,7 @@ g_timeout_dispatch (gpointer source_data, { GTimeoutData *data = source_data; - if (data->callback(user_data)) + if (data->callback (user_data)) { guint seconds = data->interval / 1000; guint msecs = data->interval - seconds * 1000; diff --git a/gmain.c b/gmain.c index 9da4fa0..0bcd51a 100644 --- a/gmain.c +++ b/gmain.c @@ -421,6 +421,12 @@ g_source_destroy_func (GHookList *hook_list, G_LOCK (main_loop); } +static void +g_source_noop (GHookList *hook_list, + GHook *hook) +{ +} + guint g_source_add (gint priority, gboolean can_recurse, @@ -437,7 +443,8 @@ g_source_add (gint priority, if (!source_list.is_setup) 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->priority = priority; @@ -1116,7 +1123,7 @@ g_timeout_dispatch (gpointer source_data, { GTimeoutData *data = source_data; - if (data->callback(user_data)) + if (data->callback (user_data)) { guint seconds = data->interval / 1000; guint msecs = data->interval - seconds * 1000; -- 2.7.4