mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-26 22:16:16 +01:00
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.
This commit is contained in:
parent
04d3d1b219
commit
5c2fb3762f
22
ChangeLog
22
ChangeLog
@ -1,3 +1,23 @@
|
||||
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
|
||||
@ -16,7 +36,7 @@ Sun Jan 17 05:12:17 1999 Tim Janik <timj@gtk.org>
|
||||
* 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
|
||||
|
@ -1,3 +1,23 @@
|
||||
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
|
||||
@ -16,7 +36,7 @@ Sun Jan 17 05:12:17 1999 Tim Janik <timj@gtk.org>
|
||||
* 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
|
||||
|
@ -1,3 +1,23 @@
|
||||
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
|
||||
@ -16,7 +36,7 @@ Sun Jan 17 05:12:17 1999 Tim Janik <timj@gtk.org>
|
||||
* 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
|
||||
|
@ -1,3 +1,23 @@
|
||||
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
|
||||
@ -16,7 +36,7 @@ Sun Jan 17 05:12:17 1999 Tim Janik <timj@gtk.org>
|
||||
* 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
|
||||
|
@ -1,3 +1,23 @@
|
||||
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
|
||||
@ -16,7 +36,7 @@ Sun Jan 17 05:12:17 1999 Tim Janik <timj@gtk.org>
|
||||
* 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
|
||||
|
@ -1,3 +1,23 @@
|
||||
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
|
||||
@ -16,7 +36,7 @@ Sun Jan 17 05:12:17 1999 Tim Janik <timj@gtk.org>
|
||||
* 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
|
||||
|
@ -1,3 +1,23 @@
|
||||
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
|
||||
@ -16,7 +36,7 @@ Sun Jan 17 05:12:17 1999 Tim Janik <timj@gtk.org>
|
||||
* 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
|
||||
|
@ -1,3 +1,23 @@
|
||||
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
|
||||
@ -16,7 +36,7 @@ Sun Jan 17 05:12:17 1999 Tim Janik <timj@gtk.org>
|
||||
* 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
|
||||
|
7
ghook.c
7
ghook.c
@ -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 */
|
||||
|
2
glib.h
2
glib.h
@ -1112,6 +1112,8 @@ typedef enum
|
||||
G_HOOK_FLAG_MASK = 0x0f
|
||||
} GHookFlagMask;
|
||||
|
||||
#define G_HOOK_DEFERRED_DESTROY ((GHookFreeFunc) 0x01)
|
||||
|
||||
struct _GHookList
|
||||
{
|
||||
guint seq_id;
|
||||
|
@ -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 */
|
||||
|
@ -1112,6 +1112,8 @@ typedef enum
|
||||
G_HOOK_FLAG_MASK = 0x0f
|
||||
} GHookFlagMask;
|
||||
|
||||
#define G_HOOK_DEFERRED_DESTROY ((GHookFreeFunc) 0x01)
|
||||
|
||||
struct _GHookList
|
||||
{
|
||||
guint seq_id;
|
||||
|
18
glib/gmain.c
18
glib/gmain.c
@ -400,7 +400,7 @@ g_source_compare (GHook *a,
|
||||
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)
|
||||
@ -421,12 +421,6 @@ g_source_destroy_func (GHookList *hook_list,
|
||||
G_LOCK (main_loop);
|
||||
}
|
||||
|
||||
static void
|
||||
g_source_noop (GHookList *hook_list,
|
||||
GHook *hook)
|
||||
{
|
||||
}
|
||||
|
||||
guint
|
||||
g_source_add (gint priority,
|
||||
gboolean can_recurse,
|
||||
@ -441,12 +435,14 @@ g_source_add (gint priority,
|
||||
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;
|
||||
|
18
gmain.c
18
gmain.c
@ -400,7 +400,7 @@ g_source_compare (GHook *a,
|
||||
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)
|
||||
@ -421,12 +421,6 @@ g_source_destroy_func (GHookList *hook_list,
|
||||
G_LOCK (main_loop);
|
||||
}
|
||||
|
||||
static void
|
||||
g_source_noop (GHookList *hook_list,
|
||||
GHook *hook)
|
||||
{
|
||||
}
|
||||
|
||||
guint
|
||||
g_source_add (gint priority,
|
||||
gboolean can_recurse,
|
||||
@ -441,12 +435,14 @@ g_source_add (gint priority,
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user