add an object member to the structure. (weak_refs_notify): pass

2001-08-17  James Henstridge  <james@daa.com.au>

	* 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.
This commit is contained in:
James Henstridge 2001-08-18 03:07:48 +00:00 committed by James Henstridge
parent 2da4b710cd
commit f240813ff6
3 changed files with 17 additions and 2 deletions

View File

@ -1,3 +1,15 @@
2001-08-17 James Henstridge <james@daa.com.au>
* 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 <timj@gtk.org>
* gtype.h: if __GNUC__ is defined, inline a test for an exact type

View File

@ -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;
}

View File

@ -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;