reentrancy fixups
authorTim Janik <timj@src.gnome.org>
Sun, 17 Jan 1999 05:03:18 +0000 (05:03 +0000)
committerTim Janik <timj@src.gnome.org>
Sun, 17 Jan 1999 05:03:18 +0000 (05:03 +0000)
ghook.c
glib/ghook.c
glib/gmain.c
gmain.c

diff --git a/ghook.c b/ghook.c
index 89c7cfb..4464db4 100644 (file)
--- 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 */
     }
 }
index 89c7cfb..4464db4 100644 (file)
@@ -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 */
     }
 }
index 9da4fa0..0bcd51a 100644 (file)
@@ -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 (file)
--- 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;