+Sun Jan 17 14:13:52 1999 Tim Janik <timj@gtk.org>
+
+ * glib.h: added a define G_HOOK_DEFERRED_DESTROY, to substitute a noop
+ GHookList.hook_destroy function.
+
+ * ghook.c (g_hook_destroy_link): don't really call hook_destroy if it
+ is G_HOOK_DEFERRED_DESTROY. for the case where we invoke hook->destroy()
+ we now clean up the hook completely afterwards, i.e. data, func and
+ destroy are immediately set to NULL and hook_free can't play with that
+ values anymore.
+
+ * gmain.c (g_source_add): set hook_destroy to G_HOOK_DEFERRED_DESTROY,
+ instead of using an ugly _noop() hack, this is to avoid an uneccessary
+ function invokation. set hook_free to g_source_destroy_func, this way
+ we always invoke the destroy notifiers for user_data and source_data
+ after execution of dispatch(). thus, g_source_destroy_func() will always
+ be called within the main_loop lock (this wasn't really assured
+ before), and can release and reaquire the look around destroy notifier
+ invokation.
+
Sun Jan 17 11:01:40 1999 Tor Lillqvist <tml@iki.fi>
* config.h.win32 glibconfig.h.win32: Increment version number here
* gmain.c: removed g_source_free_func and added g_source_destroy_func,
which marshalls the user_data and source_data destructors of sources
outside of the main_loop lock.
- removed GIdleData struct since its single member callback can be passed
+ removed GIdleData struct since its sole member callback can be passed
as source_data directly.
added a gboolean return value to all g_source_remove* functions,
indicating whether the source could be removed, because these functions
+Sun Jan 17 14:13:52 1999 Tim Janik <timj@gtk.org>
+
+ * glib.h: added a define G_HOOK_DEFERRED_DESTROY, to substitute a noop
+ GHookList.hook_destroy function.
+
+ * ghook.c (g_hook_destroy_link): don't really call hook_destroy if it
+ is G_HOOK_DEFERRED_DESTROY. for the case where we invoke hook->destroy()
+ we now clean up the hook completely afterwards, i.e. data, func and
+ destroy are immediately set to NULL and hook_free can't play with that
+ values anymore.
+
+ * gmain.c (g_source_add): set hook_destroy to G_HOOK_DEFERRED_DESTROY,
+ instead of using an ugly _noop() hack, this is to avoid an uneccessary
+ function invokation. set hook_free to g_source_destroy_func, this way
+ we always invoke the destroy notifiers for user_data and source_data
+ after execution of dispatch(). thus, g_source_destroy_func() will always
+ be called within the main_loop lock (this wasn't really assured
+ before), and can release and reaquire the look around destroy notifier
+ invokation.
+
Sun Jan 17 11:01:40 1999 Tor Lillqvist <tml@iki.fi>
* config.h.win32 glibconfig.h.win32: Increment version number here
* gmain.c: removed g_source_free_func and added g_source_destroy_func,
which marshalls the user_data and source_data destructors of sources
outside of the main_loop lock.
- removed GIdleData struct since its single member callback can be passed
+ removed GIdleData struct since its sole member callback can be passed
as source_data directly.
added a gboolean return value to all g_source_remove* functions,
indicating whether the source could be removed, because these functions
+Sun Jan 17 14:13:52 1999 Tim Janik <timj@gtk.org>
+
+ * glib.h: added a define G_HOOK_DEFERRED_DESTROY, to substitute a noop
+ GHookList.hook_destroy function.
+
+ * ghook.c (g_hook_destroy_link): don't really call hook_destroy if it
+ is G_HOOK_DEFERRED_DESTROY. for the case where we invoke hook->destroy()
+ we now clean up the hook completely afterwards, i.e. data, func and
+ destroy are immediately set to NULL and hook_free can't play with that
+ values anymore.
+
+ * gmain.c (g_source_add): set hook_destroy to G_HOOK_DEFERRED_DESTROY,
+ instead of using an ugly _noop() hack, this is to avoid an uneccessary
+ function invokation. set hook_free to g_source_destroy_func, this way
+ we always invoke the destroy notifiers for user_data and source_data
+ after execution of dispatch(). thus, g_source_destroy_func() will always
+ be called within the main_loop lock (this wasn't really assured
+ before), and can release and reaquire the look around destroy notifier
+ invokation.
+
Sun Jan 17 11:01:40 1999 Tor Lillqvist <tml@iki.fi>
* config.h.win32 glibconfig.h.win32: Increment version number here
* gmain.c: removed g_source_free_func and added g_source_destroy_func,
which marshalls the user_data and source_data destructors of sources
outside of the main_loop lock.
- removed GIdleData struct since its single member callback can be passed
+ removed GIdleData struct since its sole member callback can be passed
as source_data directly.
added a gboolean return value to all g_source_remove* functions,
indicating whether the source could be removed, because these functions
+Sun Jan 17 14:13:52 1999 Tim Janik <timj@gtk.org>
+
+ * glib.h: added a define G_HOOK_DEFERRED_DESTROY, to substitute a noop
+ GHookList.hook_destroy function.
+
+ * ghook.c (g_hook_destroy_link): don't really call hook_destroy if it
+ is G_HOOK_DEFERRED_DESTROY. for the case where we invoke hook->destroy()
+ we now clean up the hook completely afterwards, i.e. data, func and
+ destroy are immediately set to NULL and hook_free can't play with that
+ values anymore.
+
+ * gmain.c (g_source_add): set hook_destroy to G_HOOK_DEFERRED_DESTROY,
+ instead of using an ugly _noop() hack, this is to avoid an uneccessary
+ function invokation. set hook_free to g_source_destroy_func, this way
+ we always invoke the destroy notifiers for user_data and source_data
+ after execution of dispatch(). thus, g_source_destroy_func() will always
+ be called within the main_loop lock (this wasn't really assured
+ before), and can release and reaquire the look around destroy notifier
+ invokation.
+
Sun Jan 17 11:01:40 1999 Tor Lillqvist <tml@iki.fi>
* config.h.win32 glibconfig.h.win32: Increment version number here
* gmain.c: removed g_source_free_func and added g_source_destroy_func,
which marshalls the user_data and source_data destructors of sources
outside of the main_loop lock.
- removed GIdleData struct since its single member callback can be passed
+ removed GIdleData struct since its sole member callback can be passed
as source_data directly.
added a gboolean return value to all g_source_remove* functions,
indicating whether the source could be removed, because these functions
+Sun Jan 17 14:13:52 1999 Tim Janik <timj@gtk.org>
+
+ * glib.h: added a define G_HOOK_DEFERRED_DESTROY, to substitute a noop
+ GHookList.hook_destroy function.
+
+ * ghook.c (g_hook_destroy_link): don't really call hook_destroy if it
+ is G_HOOK_DEFERRED_DESTROY. for the case where we invoke hook->destroy()
+ we now clean up the hook completely afterwards, i.e. data, func and
+ destroy are immediately set to NULL and hook_free can't play with that
+ values anymore.
+
+ * gmain.c (g_source_add): set hook_destroy to G_HOOK_DEFERRED_DESTROY,
+ instead of using an ugly _noop() hack, this is to avoid an uneccessary
+ function invokation. set hook_free to g_source_destroy_func, this way
+ we always invoke the destroy notifiers for user_data and source_data
+ after execution of dispatch(). thus, g_source_destroy_func() will always
+ be called within the main_loop lock (this wasn't really assured
+ before), and can release and reaquire the look around destroy notifier
+ invokation.
+
Sun Jan 17 11:01:40 1999 Tor Lillqvist <tml@iki.fi>
* config.h.win32 glibconfig.h.win32: Increment version number here
* gmain.c: removed g_source_free_func and added g_source_destroy_func,
which marshalls the user_data and source_data destructors of sources
outside of the main_loop lock.
- removed GIdleData struct since its single member callback can be passed
+ removed GIdleData struct since its sole member callback can be passed
as source_data directly.
added a gboolean return value to all g_source_remove* functions,
indicating whether the source could be removed, because these functions
+Sun Jan 17 14:13:52 1999 Tim Janik <timj@gtk.org>
+
+ * glib.h: added a define G_HOOK_DEFERRED_DESTROY, to substitute a noop
+ GHookList.hook_destroy function.
+
+ * ghook.c (g_hook_destroy_link): don't really call hook_destroy if it
+ is G_HOOK_DEFERRED_DESTROY. for the case where we invoke hook->destroy()
+ we now clean up the hook completely afterwards, i.e. data, func and
+ destroy are immediately set to NULL and hook_free can't play with that
+ values anymore.
+
+ * gmain.c (g_source_add): set hook_destroy to G_HOOK_DEFERRED_DESTROY,
+ instead of using an ugly _noop() hack, this is to avoid an uneccessary
+ function invokation. set hook_free to g_source_destroy_func, this way
+ we always invoke the destroy notifiers for user_data and source_data
+ after execution of dispatch(). thus, g_source_destroy_func() will always
+ be called within the main_loop lock (this wasn't really assured
+ before), and can release and reaquire the look around destroy notifier
+ invokation.
+
Sun Jan 17 11:01:40 1999 Tor Lillqvist <tml@iki.fi>
* config.h.win32 glibconfig.h.win32: Increment version number here
* gmain.c: removed g_source_free_func and added g_source_destroy_func,
which marshalls the user_data and source_data destructors of sources
outside of the main_loop lock.
- removed GIdleData struct since its single member callback can be passed
+ removed GIdleData struct since its sole member callback can be passed
as source_data directly.
added a gboolean return value to all g_source_remove* functions,
indicating whether the source could be removed, because these functions
+Sun Jan 17 14:13:52 1999 Tim Janik <timj@gtk.org>
+
+ * glib.h: added a define G_HOOK_DEFERRED_DESTROY, to substitute a noop
+ GHookList.hook_destroy function.
+
+ * ghook.c (g_hook_destroy_link): don't really call hook_destroy if it
+ is G_HOOK_DEFERRED_DESTROY. for the case where we invoke hook->destroy()
+ we now clean up the hook completely afterwards, i.e. data, func and
+ destroy are immediately set to NULL and hook_free can't play with that
+ values anymore.
+
+ * gmain.c (g_source_add): set hook_destroy to G_HOOK_DEFERRED_DESTROY,
+ instead of using an ugly _noop() hack, this is to avoid an uneccessary
+ function invokation. set hook_free to g_source_destroy_func, this way
+ we always invoke the destroy notifiers for user_data and source_data
+ after execution of dispatch(). thus, g_source_destroy_func() will always
+ be called within the main_loop lock (this wasn't really assured
+ before), and can release and reaquire the look around destroy notifier
+ invokation.
+
Sun Jan 17 11:01:40 1999 Tor Lillqvist <tml@iki.fi>
* config.h.win32 glibconfig.h.win32: Increment version number here
* gmain.c: removed g_source_free_func and added g_source_destroy_func,
which marshalls the user_data and source_data destructors of sources
outside of the main_loop lock.
- removed GIdleData struct since its single member callback can be passed
+ removed GIdleData struct since its sole member callback can be passed
as source_data directly.
added a gboolean return value to all g_source_remove* functions,
indicating whether the source could be removed, because these functions
+Sun Jan 17 14:13:52 1999 Tim Janik <timj@gtk.org>
+
+ * glib.h: added a define G_HOOK_DEFERRED_DESTROY, to substitute a noop
+ GHookList.hook_destroy function.
+
+ * ghook.c (g_hook_destroy_link): don't really call hook_destroy if it
+ is G_HOOK_DEFERRED_DESTROY. for the case where we invoke hook->destroy()
+ we now clean up the hook completely afterwards, i.e. data, func and
+ destroy are immediately set to NULL and hook_free can't play with that
+ values anymore.
+
+ * gmain.c (g_source_add): set hook_destroy to G_HOOK_DEFERRED_DESTROY,
+ instead of using an ugly _noop() hack, this is to avoid an uneccessary
+ function invokation. set hook_free to g_source_destroy_func, this way
+ we always invoke the destroy notifiers for user_data and source_data
+ after execution of dispatch(). thus, g_source_destroy_func() will always
+ be called within the main_loop lock (this wasn't really assured
+ before), and can release and reaquire the look around destroy notifier
+ invokation.
+
Sun Jan 17 11:01:40 1999 Tor Lillqvist <tml@iki.fi>
* config.h.win32 glibconfig.h.win32: Increment version number here
* gmain.c: removed g_source_free_func and added g_source_destroy_func,
which marshalls the user_data and source_data destructors of sources
outside of the main_loop lock.
- removed GIdleData struct since its single member callback can be passed
+ removed GIdleData struct since its sole member callback can be passed
as source_data directly.
added a gboolean return value to all g_source_remove* functions,
indicating whether the source could be removed, because these functions
hook->hook_id = 0;
hook->flags &= ~G_HOOK_FLAG_ACTIVE;
if (hook_list->hook_destroy)
- hook_list->hook_destroy (hook_list, hook);
+ {
+ if (hook_list->hook_destroy != G_HOOK_DEFERRED_DESTROY)
+ hook_list->hook_destroy (hook_list, hook);
+ }
else if (hook->destroy)
{
hook->destroy (hook->data);
+ hook->data = NULL;
+ hook->func = NULL;
hook->destroy = NULL;
}
g_hook_unref (hook_list, hook); /* counterpart to g_hook_insert_before */
G_HOOK_FLAG_MASK = 0x0f
} GHookFlagMask;
+#define G_HOOK_DEFERRED_DESTROY ((GHookFreeFunc) 0x01)
+
struct _GHookList
{
guint seq_id;
hook->hook_id = 0;
hook->flags &= ~G_HOOK_FLAG_ACTIVE;
if (hook_list->hook_destroy)
- hook_list->hook_destroy (hook_list, hook);
+ {
+ if (hook_list->hook_destroy != G_HOOK_DEFERRED_DESTROY)
+ hook_list->hook_destroy (hook_list, hook);
+ }
else if (hook->destroy)
{
hook->destroy (hook->data);
+ hook->data = NULL;
+ hook->func = NULL;
hook->destroy = NULL;
}
g_hook_unref (hook_list, hook); /* counterpart to g_hook_insert_before */
G_HOOK_FLAG_MASK = 0x0f
} GHookFlagMask;
+#define G_HOOK_DEFERRED_DESTROY ((GHookFreeFunc) 0x01)
+
struct _GHookList
{
guint seq_id;
return (source_a->priority < source_b->priority) ? -1 : 1;
}
-/* HOLDS: main_loop_lock */
+/* HOLDS: main_loop lock */
static void
g_source_destroy_func (GHookList *hook_list,
GHook *hook)
G_LOCK (main_loop);
}
-static void
-g_source_noop (GHookList *hook_list,
- GHook *hook)
-{
-}
-
guint
g_source_add (gint priority,
gboolean can_recurse,
G_LOCK (main_loop);
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_noop;
- source_list.hook_free = g_source_destroy_func;
+ source_list.hook_destroy = G_HOOK_DEFERRED_DESTROY;
+ 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->source_data = source_data;
source->hook.func = funcs;
return (source_a->priority < source_b->priority) ? -1 : 1;
}
-/* HOLDS: main_loop_lock */
+/* HOLDS: main_loop lock */
static void
g_source_destroy_func (GHookList *hook_list,
GHook *hook)
G_LOCK (main_loop);
}
-static void
-g_source_noop (GHookList *hook_list,
- GHook *hook)
-{
-}
-
guint
g_source_add (gint priority,
gboolean can_recurse,
G_LOCK (main_loop);
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_noop;
- source_list.hook_free = g_source_destroy_func;
+ source_list.hook_destroy = G_HOOK_DEFERRED_DESTROY;
+ 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->source_data = source_data;
source->hook.func = funcs;