[gnome-shell] recorder: Clean up stage lifetime handling



commit f9819eb7b0e98d7015017a95293163c2e235247b
Author: Ray Strode <rstrode redhat com>
Date:   Thu Jul 26 17:31:11 2012 -0400

    recorder: Clean up stage lifetime handling
    
    The stage is a floating object. We don't own a reference
    to it, so we shouldn't unref it.
    
    This commit removes the erroneous unref call and makes sure
    we call clutter_actor_destroy on the stage when we're done
    with it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=680647

 src/test-recorder.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/src/test-recorder.c b/src/test-recorder.c
index de856f8..69f6f60 100644
--- a/src/test-recorder.c
+++ b/src/test-recorder.c
@@ -11,7 +11,7 @@
 static ShellRecorder *recorder = NULL;
 
 static gboolean
-stop_recording_timeout (gpointer data)
+stop_recording_timeout (ClutterActor *stage)
 {
   if (recorder)
     {
@@ -19,15 +19,16 @@ stop_recording_timeout (gpointer data)
       g_object_unref (recorder);
     }
 
-  clutter_main_quit ();
+  clutter_actor_destroy (stage);
 
   return FALSE;
 }
 
 static void
-on_animation_completed (ClutterAnimation *animation)
+on_animation_completed (ClutterAnimation *animation,
+                        ClutterStage     *stage)
 {
-  g_timeout_add (1000, stop_recording_timeout, NULL);
+  g_timeout_add (1000, (GSourceFunc) stop_recording_timeout, stage);
 }
 
 static void
@@ -69,7 +70,7 @@ int main (int argc, char **argv)
 				     "y", 240.0,
 				     NULL);
   g_signal_connect (animation, "completed",
-		    G_CALLBACK (on_animation_completed), NULL);
+		    G_CALLBACK (on_animation_completed), stage);
 
   text = g_object_new (CLUTTER_TYPE_TEXT,
 		       "text", "Blue",
@@ -110,7 +111,5 @@ int main (int argc, char **argv)
 
   clutter_main ();
 
-  g_object_unref (stage);
-
   return 0;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]