? docs/reference/version.xml
Index: gobject/gobjectmodule.c
===================================================================
RCS file: /cvs/gnome/pygobject/gobject/gobjectmodule.c,v
retrieving revision 1.229
diff -u -p -d -r1.229 gobjectmodule.c
--- gobject/gobjectmodule.c	26 Aug 2006 17:06:25 -0000	1.229
+++ gobject/gobjectmodule.c	26 Aug 2006 22:37:46 -0000
@@ -1173,8 +1173,9 @@ pygobject__g_instance_init(GTypeInstance
     wrapper = g_object_get_qdata(object, pygobject_wrapper_key); 
     if (wrapper == NULL) {
         wrapper = pygobject_init_wrapper_get();
-        if (wrapper) {
-            g_object_set_qdata(object, pygobject_wrapper_key, wrapper);
+        if (wrapper && ((PyGObject *) wrapper)->obj == NULL) {
+            ((PyGObject *) wrapper)->obj = object;
+            pygobject_register_wrapper(wrapper);
         }
     }
     pygobject_init_wrapper_set(NULL);
@@ -3070,11 +3071,16 @@ pygobject_constructv(PyGObject  *self,
                      GParameter *parameters)
 {
     if (self->obj == NULL) {
+        GObject *obj;
         pygobject_init_wrapper_set((PyObject *) self);
-        self->obj = g_object_newv(pyg_type_from_object((PyObject *) self),
-                                  n_parameters, parameters);
+        obj = g_object_newv(pyg_type_from_object((PyObject *) self),
+                            n_parameters, parameters);
         pygobject_init_wrapper_set(NULL);
-        pygobject_register_wrapper((PyObject *) self);
+        if (self->obj == NULL) {
+            self->obj = obj;
+            pygobject_sink(obj);
+            pygobject_register_wrapper((PyObject *) self);
+        }
     } else {
         int i;
         for (i = 0; i < n_parameters; ++i)
Index: tests/test_signal.py
===================================================================
RCS file: /cvs/gnome/pygobject/tests/test_signal.py,v
retrieving revision 1.11
diff -u -p -d -r1.11 test_signal.py
--- tests/test_signal.py	24 Jun 2006 16:06:41 -0000	1.11
+++ tests/test_signal.py	26 Aug 2006 22:37:47 -0000
@@ -211,7 +211,35 @@ class TestClosures(unittest.TestCase):
         c = C(self)
         data = c.emit("my_signal", "\01\00\02")
         self.assertEqual(data, "\02\00\01")
-        
+
+class SigPropClass(gobject.GObject):
+    __gsignals__ = { 'my_signal': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
+                                   (gobject.TYPE_INT,)) }
+
+    __gproperties__ = {
+        'foo': (str, None, None, '', gobject.PARAM_WRITABLE|gobject.PARAM_CONSTRUCT),
+        }
+
+    signal_emission_failed = False
+
+    def do_my_signal(self, arg):
+        self.arg = arg
+
+    def do_set_property(self, pspec, value):
+        if pspec.name == 'foo':
+            self._foo = value
+        else:
+            raise AttributeError, 'unknown property %s' % pspec.name
+        try:
+            self.emit("my-signal", 1)
+        except TypeError:
+            self.signal_emission_failed = True
+
+
+class TestSigProp(unittest.TestCase):
+    def testEmitInPropertySetter(self):
+        obj = SigPropClass()
+        self.failIf(obj.signal_emission_failed)
 
 if __name__ == '__main__':
     unittest.main()
