mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
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.
This commit is contained in:
parent
e54410edc2
commit
958f33656a
@ -1,3 +1,9 @@
|
||||
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.
|
||||
|
||||
Sun Nov 29 17:31:43 EST 1998 Jeff Garzik <jgarzik@pobox.com>
|
||||
|
||||
* configure.in, Makefile.am, gmodule/Makefile.am:
|
||||
|
@ -1,3 +1,9 @@
|
||||
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.
|
||||
|
||||
Sun Nov 29 17:31:43 EST 1998 Jeff Garzik <jgarzik@pobox.com>
|
||||
|
||||
* configure.in, Makefile.am, gmodule/Makefile.am:
|
||||
|
@ -1,3 +1,9 @@
|
||||
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.
|
||||
|
||||
Sun Nov 29 17:31:43 EST 1998 Jeff Garzik <jgarzik@pobox.com>
|
||||
|
||||
* configure.in, Makefile.am, gmodule/Makefile.am:
|
||||
|
@ -1,3 +1,9 @@
|
||||
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.
|
||||
|
||||
Sun Nov 29 17:31:43 EST 1998 Jeff Garzik <jgarzik@pobox.com>
|
||||
|
||||
* configure.in, Makefile.am, gmodule/Makefile.am:
|
||||
|
@ -1,3 +1,9 @@
|
||||
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.
|
||||
|
||||
Sun Nov 29 17:31:43 EST 1998 Jeff Garzik <jgarzik@pobox.com>
|
||||
|
||||
* configure.in, Makefile.am, gmodule/Makefile.am:
|
||||
|
@ -1,3 +1,9 @@
|
||||
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.
|
||||
|
||||
Sun Nov 29 17:31:43 EST 1998 Jeff Garzik <jgarzik@pobox.com>
|
||||
|
||||
* configure.in, Makefile.am, gmodule/Makefile.am:
|
||||
|
@ -1,3 +1,9 @@
|
||||
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.
|
||||
|
||||
Sun Nov 29 17:31:43 EST 1998 Jeff Garzik <jgarzik@pobox.com>
|
||||
|
||||
* configure.in, Makefile.am, gmodule/Makefile.am:
|
||||
|
@ -1,3 +1,9 @@
|
||||
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.
|
||||
|
||||
Sun Nov 29 17:31:43 EST 1998 Jeff Garzik <jgarzik@pobox.com>
|
||||
|
||||
* configure.in, Makefile.am, gmodule/Makefile.am:
|
||||
|
36
ghook.c
36
ghook.c
@ -323,6 +323,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,
|
||||
|
6
glib.h
6
glib.h
@ -765,6 +765,8 @@ typedef gboolean (*GHookFindFunc) (GHook *hook,
|
||||
gpointer data);
|
||||
typedef void (*GHookMarshaller) (GHook *hook,
|
||||
gpointer data);
|
||||
typedef gboolean (*GHookCheckMarshaller) (GHook *hook,
|
||||
gpointer data);
|
||||
typedef void (*GHookFunc) (gpointer data);
|
||||
typedef gboolean (*GHookCheckFunc) (gpointer data);
|
||||
typedef void (*GHookFreeFunc) (GHookList *hook_list,
|
||||
@ -1215,6 +1217,10 @@ void g_hook_list_marshal (GHookList *hook_list,
|
||||
gboolean may_recurse,
|
||||
GHookMarshaller marshaller,
|
||||
gpointer data);
|
||||
void g_hook_list_marshal_check (GHookList *hook_list,
|
||||
gboolean may_recurse,
|
||||
GHookCheckMarshaller marshaller,
|
||||
gpointer data);
|
||||
|
||||
|
||||
/* Fatal error handlers.
|
||||
|
36
glib/ghook.c
36
glib/ghook.c
@ -323,6 +323,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,
|
||||
|
@ -765,6 +765,8 @@ typedef gboolean (*GHookFindFunc) (GHook *hook,
|
||||
gpointer data);
|
||||
typedef void (*GHookMarshaller) (GHook *hook,
|
||||
gpointer data);
|
||||
typedef gboolean (*GHookCheckMarshaller) (GHook *hook,
|
||||
gpointer data);
|
||||
typedef void (*GHookFunc) (gpointer data);
|
||||
typedef gboolean (*GHookCheckFunc) (gpointer data);
|
||||
typedef void (*GHookFreeFunc) (GHookList *hook_list,
|
||||
@ -1215,6 +1217,10 @@ void g_hook_list_marshal (GHookList *hook_list,
|
||||
gboolean may_recurse,
|
||||
GHookMarshaller marshaller,
|
||||
gpointer data);
|
||||
void g_hook_list_marshal_check (GHookList *hook_list,
|
||||
gboolean may_recurse,
|
||||
GHookCheckMarshaller marshaller,
|
||||
gpointer data);
|
||||
|
||||
|
||||
/* Fatal error handlers.
|
||||
|
Loading…
Reference in New Issue
Block a user