actor: Make set_flags() safe from unrefs
authorEmmanuele Bassi <ebassi@linux.intel.com>
Thu, 29 Jul 2010 16:00:24 +0000 (17:00 +0100)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Thu, 29 Jul 2010 16:00:24 +0000 (17:00 +0100)
It's possible - though not recommended - that user code causes the
destruction of an actor in one of the notification handlers for
flag-based properties. We should protect the multiple notification
emission with g_object_ref/unref.

clutter/clutter-actor.c

index 91adfa9..863243e 100644 (file)
@@ -10368,6 +10368,7 @@ clutter_actor_set_flags (ClutterActor      *self,
     return;
 
   obj = G_OBJECT (self);
+  g_object_ref (obj);
   g_object_freeze_notify (obj);
 
   old_flags = self->flags;
@@ -10397,6 +10398,7 @@ clutter_actor_set_flags (ClutterActor      *self,
     g_object_notify (obj, "visible");
 
   g_object_thaw_notify (obj);
+  g_object_unref (obj);
 }
 
 /**