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
This commit is contained in:
Ray Strode 2012-07-26 17:31:11 -04:00
parent 85728f0d15
commit f9819eb7b0

View File

@ -11,7 +11,7 @@
static ShellRecorder *recorder = NULL; static ShellRecorder *recorder = NULL;
static gboolean static gboolean
stop_recording_timeout (gpointer data) stop_recording_timeout (ClutterActor *stage)
{ {
if (recorder) if (recorder)
{ {
@ -19,15 +19,16 @@ stop_recording_timeout (gpointer data)
g_object_unref (recorder); g_object_unref (recorder);
} }
clutter_main_quit (); clutter_actor_destroy (stage);
return FALSE; return FALSE;
} }
static void 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 static void
@ -69,7 +70,7 @@ int main (int argc, char **argv)
"y", 240.0, "y", 240.0,
NULL); NULL);
g_signal_connect (animation, "completed", 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 = g_object_new (CLUTTER_TYPE_TEXT,
"text", "Blue", "text", "Blue",
@ -110,7 +111,5 @@ int main (int argc, char **argv)
clutter_main (); clutter_main ();
g_object_unref (stage);
return 0; return 0;
} }