summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog22
-rw-r--r--ChangeLog.pre-2-022
-rw-r--r--ChangeLog.pre-2-1022
-rw-r--r--ChangeLog.pre-2-1222
-rw-r--r--ChangeLog.pre-2-222
-rw-r--r--ChangeLog.pre-2-422
-rw-r--r--ChangeLog.pre-2-622
-rw-r--r--ChangeLog.pre-2-822
-rw-r--r--ghook.c7
-rw-r--r--glib.h2
-rw-r--r--glib/ghook.c7
-rw-r--r--glib/glib.h2
-rw-r--r--glib/gmain.c18
-rw-r--r--gmain.c18
14 files changed, 198 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index 1f144d252..7762008e1 100644
--- a/ChangeLog
+++ b/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
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 1f144d252..7762008e1 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -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
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 1f144d252..7762008e1 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -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
diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12
index 1f144d252..7762008e1 100644
--- a/ChangeLog.pre-2-12
+++ b/ChangeLog.pre-2-12
@@ -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
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 1f144d252..7762008e1 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -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
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 1f144d252..7762008e1 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -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
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 1f144d252..7762008e1 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -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
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 1f144d252..7762008e1 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -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
diff --git a/ghook.c b/ghook.c
index fae692796..7e1c82dea 100644
--- a/ghook.c
+++ b/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 */
diff --git a/glib.h b/glib.h
index 6848d2b7b..03951b6e8 100644
--- a/glib.h
+++ b/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;
diff --git a/glib/ghook.c b/glib/ghook.c
index fae692796..7e1c82dea 100644
--- a/glib/ghook.c
+++ b/glib/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 */
diff --git a/glib/glib.h b/glib/glib.h
index 6848d2b7b..03951b6e8 100644
--- a/glib/glib.h
+++ b/glib/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;
diff --git a/glib/gmain.c b/glib/gmain.c
index 0bcd51abd..28ff0574e 100644
--- a/glib/gmain.c
+++ b/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;
diff --git a/gmain.c b/gmain.c
index 0bcd51abd..28ff0574e 100644
--- a/gmain.c
+++ b/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;