+Thu Jan 7 15:14:08 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gmain.c (g_source_free_func): Call the source-specific
+ free function when the hook is freed not when it
+ is destroyed; this fixes a bug where a timeout destroyed
+ from itself would access already freed data.
+
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gutils.c (g_get_any_init): Here we must replace getpwuid by
+Thu Jan 7 15:14:08 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gmain.c (g_source_free_func): Call the source-specific
+ free function when the hook is freed not when it
+ is destroyed; this fixes a bug where a timeout destroyed
+ from itself would access already freed data.
+
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gutils.c (g_get_any_init): Here we must replace getpwuid by
+Thu Jan 7 15:14:08 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gmain.c (g_source_free_func): Call the source-specific
+ free function when the hook is freed not when it
+ is destroyed; this fixes a bug where a timeout destroyed
+ from itself would access already freed data.
+
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gutils.c (g_get_any_init): Here we must replace getpwuid by
+Thu Jan 7 15:14:08 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gmain.c (g_source_free_func): Call the source-specific
+ free function when the hook is freed not when it
+ is destroyed; this fixes a bug where a timeout destroyed
+ from itself would access already freed data.
+
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gutils.c (g_get_any_init): Here we must replace getpwuid by
+Thu Jan 7 15:14:08 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gmain.c (g_source_free_func): Call the source-specific
+ free function when the hook is freed not when it
+ is destroyed; this fixes a bug where a timeout destroyed
+ from itself would access already freed data.
+
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gutils.c (g_get_any_init): Here we must replace getpwuid by
+Thu Jan 7 15:14:08 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gmain.c (g_source_free_func): Call the source-specific
+ free function when the hook is freed not when it
+ is destroyed; this fixes a bug where a timeout destroyed
+ from itself would access already freed data.
+
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gutils.c (g_get_any_init): Here we must replace getpwuid by
+Thu Jan 7 15:14:08 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gmain.c (g_source_free_func): Call the source-specific
+ free function when the hook is freed not when it
+ is destroyed; this fixes a bug where a timeout destroyed
+ from itself would access already freed data.
+
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gutils.c (g_get_any_init): Here we must replace getpwuid by
+Thu Jan 7 15:14:08 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gmain.c (g_source_free_func): Call the source-specific
+ free function when the hook is freed not when it
+ is destroyed; this fixes a bug where a timeout destroyed
+ from itself would access already freed data.
+
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gutils.c (g_get_any_init): Here we must replace getpwuid by
/* Forward declarations */
+static gint g_source_compare (GHook *a,
+ GHook *b);
+static void g_source_free_func (GHookList *hook_list,
+ GHook *hook);
static void g_main_poll (gint timeout,
gboolean use_priority,
gint priority);
return (source_a->priority < source_b->priority) ? -1 : 1;
}
+static void
+g_source_free_func (GHookList *hook_list,
+ GHook *hook)
+{
+ GSource *source = (GSource *)hook;
+
+ ((GSourceFuncs *) hook->func)->destroy (source->source_data);
+}
+
guint
g_source_add (gint priority,
gboolean can_recurse,
if (!source_list.is_setup)
g_hook_list_init (&source_list, sizeof(GSource));
+ source_list.hook_free = g_source_free_func;
+
source = (GSource *)g_hook_alloc (&source_list);
source->priority = priority;
source->source_data = source_data;
hook = g_hook_get (&source_list, tag);
if (hook)
- {
- GSource *source = (GSource *)hook;
-
- ((GSourceFuncs *) source->hook.func)->destroy (source->source_data);
- g_hook_destroy_link (&source_list, hook);
- }
+ g_hook_destroy_link (&source_list, hook);
G_UNLOCK (main_loop);
}
hook = g_hook_find_data (&source_list, TRUE, user_data);
if (hook)
- {
- GSource *source = (GSource *)hook;
-
- ((GSourceFuncs *) source->hook.func)->destroy (source->source_data);
- g_hook_destroy_link (&source_list, hook);
- }
+ g_hook_destroy_link (&source_list, hook);
G_UNLOCK (main_loop);
}
hook = g_hook_find (&source_list, TRUE,
g_source_find_source_data, source_data);
if (hook)
- {
- GSource *source = (GSource *)hook;
-
- ((GSourceFuncs *) source->hook.func)->destroy (source->source_data);
- g_hook_destroy_link (&source_list, hook);
- }
+ g_hook_destroy_link (&source_list, hook);
G_UNLOCK (main_loop);
}
source->hook.flags &= ~G_HOOK_FLAG_IN_CALL;
if (need_destroy && G_HOOK_IS_VALID (source))
- {
- ((GSourceFuncs *) source->hook.func)->destroy (source->source_data);
- g_hook_destroy_link (&source_list, (GHook *) source);
- }
+ g_hook_destroy_link (&source_list, (GHook *) source);
}
g_hook_unref (&source_list, (GHook*) source);
/* Forward declarations */
+static gint g_source_compare (GHook *a,
+ GHook *b);
+static void g_source_free_func (GHookList *hook_list,
+ GHook *hook);
static void g_main_poll (gint timeout,
gboolean use_priority,
gint priority);
return (source_a->priority < source_b->priority) ? -1 : 1;
}
+static void
+g_source_free_func (GHookList *hook_list,
+ GHook *hook)
+{
+ GSource *source = (GSource *)hook;
+
+ ((GSourceFuncs *) hook->func)->destroy (source->source_data);
+}
+
guint
g_source_add (gint priority,
gboolean can_recurse,
if (!source_list.is_setup)
g_hook_list_init (&source_list, sizeof(GSource));
+ source_list.hook_free = g_source_free_func;
+
source = (GSource *)g_hook_alloc (&source_list);
source->priority = priority;
source->source_data = source_data;
hook = g_hook_get (&source_list, tag);
if (hook)
- {
- GSource *source = (GSource *)hook;
-
- ((GSourceFuncs *) source->hook.func)->destroy (source->source_data);
- g_hook_destroy_link (&source_list, hook);
- }
+ g_hook_destroy_link (&source_list, hook);
G_UNLOCK (main_loop);
}
hook = g_hook_find_data (&source_list, TRUE, user_data);
if (hook)
- {
- GSource *source = (GSource *)hook;
-
- ((GSourceFuncs *) source->hook.func)->destroy (source->source_data);
- g_hook_destroy_link (&source_list, hook);
- }
+ g_hook_destroy_link (&source_list, hook);
G_UNLOCK (main_loop);
}
hook = g_hook_find (&source_list, TRUE,
g_source_find_source_data, source_data);
if (hook)
- {
- GSource *source = (GSource *)hook;
-
- ((GSourceFuncs *) source->hook.func)->destroy (source->source_data);
- g_hook_destroy_link (&source_list, hook);
- }
+ g_hook_destroy_link (&source_list, hook);
G_UNLOCK (main_loop);
}
source->hook.flags &= ~G_HOOK_FLAG_IN_CALL;
if (need_destroy && G_HOOK_IS_VALID (source))
- {
- ((GSourceFuncs *) source->hook.func)->destroy (source->source_data);
- g_hook_destroy_link (&source_list, (GHook *) source);
- }
+ g_hook_destroy_link (&source_list, (GHook *) source);
}
g_hook_unref (&source_list, (GHook*) source);