[gobject] set all properties before constructed()
authorRyan Lortie <desrt@desrt.ca>
Mon, 8 Oct 2012 15:40:00 +0000 (11:40 -0400)
committerRyan Lortie <desrt@desrt.ca>
Mon, 8 Oct 2012 15:40:00 +0000 (11:40 -0400)
Move the constructed() call to happen after all of the properties are
set (not just the construct properties).

This is an incompatible change but we are making it under the belief
that it should be safe.  If this change impacts you in a negative way
please comment on the bug.

https://bugzilla.gnome.org/show_bug.cgi?id=685733

gobject/gobject.c

index 79c04011b0960bed7b3c3a6634341ff1102ff0cd..5f60dd6da7549af1ee0d66f76110dc516858ee2e 100644 (file)
@@ -1741,15 +1741,15 @@ g_object_newv (GType       object_type,
        g_object_notify_queue_thaw (object, nqueue);
     }
 
-  /* run 'constructed' handler if there is a custom one */
-  if (newly_constructed && CLASS_HAS_CUSTOM_CONSTRUCTED (class))
-    class->constructed (object);
-
   /* set remaining properties */
   for (i = 0; i < n_oparams; i++)
     object_set_property (object, oparams[i].pspec, oparams[i].value, nqueue);
   g_free (oparams);
 
+  /* run 'constructed' handler if there is a custom one */
+  if (newly_constructed && CLASS_HAS_CUSTOM_CONSTRUCTED (class))
+    class->constructed (object);
+
   if (CLASS_HAS_PROPS (class))
     {
       /* release our own freeze count and handle notifications */