diff options
author | Tim Janik <timj@gtk.org> | 1999-01-17 14:52:20 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 1999-01-17 14:52:20 +0000 |
commit | 5c2fb3762f9174d78213b2b2d8934883919b4f67 (patch) | |
tree | 75e90b89315b0eabead2fda2c151e3a298a9ff2e /ghook.c | |
parent | 04d3d1b219347582f55b712b1fbe98fa26d22d84 (diff) | |
download | glib-5c2fb3762f9174d78213b2b2d8934883919b4f67.tar.gz |
added a define G_HOOK_DEFERRED_DESTROY, to substitute a noop
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.
Diffstat (limited to 'ghook.c')
-rw-r--r-- | ghook.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -131,10 +131,15 @@ 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); + { + 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 */ |