From f240813ff68977d7ce7c775ffc9d632c16c867ec Mon Sep 17 00:00:00 2001 From: James Henstridge Date: Sat, 18 Aug 2001 03:07:48 +0000 Subject: [PATCH] add an object member to the structure. (weak_refs_notify): pass 2001-08-17 James Henstridge * gobject.c (WeakRefStack): add an object member to the structure. (weak_refs_notify): pass wstack->object as extra argument to notify functions. (g_object_weak_ref): set wstack->object when initialising WeakRefStack. * gobject.h (GWeakNotify): add second argument to prototype which gives the pointer to where the object that is being disposed of was. --- gobject/ChangeLog | 12 ++++++++++++ gobject/gobject.c | 4 +++- gobject/gobject.h | 3 ++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/gobject/ChangeLog b/gobject/ChangeLog index 7a69dea5d..7e5a608bf 100644 --- a/gobject/ChangeLog +++ b/gobject/ChangeLog @@ -1,3 +1,15 @@ +2001-08-17 James Henstridge + + * gobject.c (WeakRefStack): add an object member to the structure. + (weak_refs_notify): pass wstack->object as extra argument to + notify functions. + (g_object_weak_ref): set wstack->object when initialising + WeakRefStack. + + * gobject.h (GWeakNotify): add second argument to prototype which + gives the pointer to where the object that is being disposed of + was. + Wed Jul 18 19:42:31 2001 Tim Janik * gtype.h: if __GNUC__ is defined, inline a test for an exact type diff --git a/gobject/gobject.c b/gobject/gobject.c index e1855e171..3cbdaf4c1 100644 --- a/gobject/gobject.c +++ b/gobject/gobject.c @@ -1181,6 +1181,7 @@ g_object_disconnect (gpointer _object, } typedef struct { + GObject *object; guint n_weak_refs; struct { GWeakNotify notify; @@ -1195,7 +1196,7 @@ weak_refs_notify (gpointer data) guint i; for (i = 0; i < wstack->n_weak_refs; i++) - wstack->weak_refs[i].notify (wstack->weak_refs[i].data); + wstack->weak_refs[i].notify (wstack->weak_refs[i].data, wstack->object); g_free (wstack); } @@ -1220,6 +1221,7 @@ g_object_weak_ref (GObject *object, else { wstack = g_renew (WeakRefStack, NULL, 1); + wstack->object = object; wstack->n_weak_refs = 1; i = 0; } diff --git a/gobject/gobject.h b/gobject/gobject.h index 582f81cf6..0b4dbc90c 100644 --- a/gobject/gobject.h +++ b/gobject/gobject.h @@ -54,7 +54,8 @@ typedef void (*GObjectSetPropertyFunc) (GObject *object, const GValue *value, GParamSpec *pspec); typedef void (*GObjectFinalizeFunc) (GObject *object); -typedef void (*GWeakNotify) (gpointer data); +typedef void (*GWeakNotify) (gpointer data, + GObject *where_the_object_was); struct _GObject { GTypeInstance g_type_instance;