summaryrefslogtreecommitdiff
path: root/ghook.c
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>1998-11-30 07:08:54 +0000
committerTim Janik <timj@src.gnome.org>1998-11-30 07:08:54 +0000
commit958f33656a4211b747622f5e62d8fd7e7adf7cf9 (patch)
treed00a3d9894ff468285e20c3827f0f0cbf18d69e0 /ghook.c
parente54410edc27ad78049bd854738c11e54b3bc0c5b (diff)
added g_hook_list_marshal_check() to eventually destroy hooks after they
Mon Nov 30 07:12:10 1998 Tim Janik <timj@gtk.org> * glib.h: * ghook.c: added g_hook_list_marshal_check() to eventually destroy hooks after they got marshalled.
Diffstat (limited to 'ghook.c')
-rw-r--r--ghook.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/ghook.c b/ghook.c
index 2e231eab1..47a2874a4 100644
--- a/ghook.c
+++ b/ghook.c
@@ -324,6 +324,42 @@ g_hook_list_invoke_check (GHookList *hook_list,
}
void
+g_hook_list_marshal_check (GHookList *hook_list,
+ gboolean may_recurse,
+ GHookCheckMarshaller marshaller,
+ gpointer data)
+{
+ GHook *hook;
+
+ g_return_if_fail (hook_list != NULL);
+ g_return_if_fail (hook_list->is_setup);
+ g_return_if_fail (marshaller != NULL);
+
+ hook = g_hook_first_valid (hook_list, may_recurse);
+ while (hook)
+ {
+ GHook *tmp;
+ gboolean was_in_call;
+ gboolean need_destroy;
+
+ g_hook_ref (hook_list, hook);
+
+ was_in_call = G_HOOK_IN_CALL (hook);
+ hook->flags |= G_HOOK_FLAG_IN_CALL;
+ need_destroy = !marshaller (hook, data);
+ if (!was_in_call)
+ hook->flags &= ~G_HOOK_FLAG_IN_CALL;
+ if (need_destroy)
+ g_hook_destroy_link (hook_list, hook);
+
+ tmp = g_hook_next_valid (hook, may_recurse);
+
+ g_hook_unref (hook_list, hook);
+ hook = tmp;
+ }
+}
+
+void
g_hook_list_marshal (GHookList *hook_list,
gboolean may_recurse,
GHookMarshaller marshaller,