diff options
author | Gustavo J. A. M. Carneiro <gjc@src.gnome.org> | 2007-08-14 16:04:20 +0000 |
---|---|---|
committer | Gustavo J. A. M. Carneiro <gjc@src.gnome.org> | 2007-08-14 16:04:20 +0000 |
commit | bac7bd79214a78adb0180b36447474e7ae5649f3 (patch) | |
tree | 71dd7c516505d6409c560a62ba52c583423d1771 | |
parent | 99b0cae5f74639915775ebf2514ba595475e4400 (diff) | |
download | pygobject-bac7bd79214a78adb0180b36447474e7ae5649f3.tar.gz pygobject-bac7bd79214a78adb0180b36447474e7ae5649f3.tar.xz pygobject-bac7bd79214a78adb0180b36447474e7ae5649f3.zip |
Bug 466082 – pygobject_new_full not fully initialising PyGObject, chaos results
svn path=/trunk/; revision=694
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | gobject/pygobject.c | 8 |
2 files changed, 14 insertions, 2 deletions
@@ -1,3 +1,11 @@ +2007-08-14 Ed Catmur <ed@catmur.co.uk> + + reviewed by: Gustavo J. A. M. Carneiro + + * gobject/pygobject.c (pygobject_new_full, pygobject_clear), + (pygobject_get_dict): Bug 466082 – pygobject_new_full not fully + initialising PyGObject, chaos results. + 2007-08-13 Gustavo J. A. M. Carneiro <gjc@gnome.org> * tests/test_subtype.py (TestSubType.testGetDict): Add unit test diff --git a/gobject/pygobject.c b/gobject/pygobject.c index fb3fb1d..0754984 100644 --- a/gobject/pygobject.c +++ b/gobject/pygobject.c @@ -915,6 +915,7 @@ pygobject_new_full(GObject *obj, gboolean sink, gpointer g_class) return NULL; self->inst_dict = NULL; self->weakreflist = NULL; + self->private_flags.flags = 0; self->obj = obj; g_object_ref(obj); pygobject_register_wrapper_full(self, sink); @@ -1047,9 +1048,10 @@ pygobject_clear(PyGObject *self) { if (self->obj) { g_object_set_qdata_full(self->obj, pygobject_wrapper_key, NULL, NULL); - if (self->inst_dict) + if (self->inst_dict) { g_object_remove_toggle_ref(self->obj, pyg_toggle_notify, self); - else + self->private_flags.flags &= ~PYGOBJECT_USING_TOGGLE_REF; + } else g_object_unref(self->obj); self->obj = NULL; } @@ -1999,6 +2001,8 @@ pygobject_get_dict(PyGObject *self, void *closure) self->inst_dict = PyDict_New(); if (self->inst_dict == NULL) return NULL; + if (G_LIKELY(self->obj)) + pygobject_switch_to_toggle_ref(self); } Py_INCREF(self->inst_dict); return self->inst_dict; |