[gnome-shell] recorder: keep recorder object alive until pipeline finishes



commit 9171bab5e58d5f14ae356d376e18b9c2ac7ccb3c
Author: Ray Strode <rstrode redhat com>
Date:   Thu Jul 26 17:26:55 2012 -0400

    recorder: keep recorder object alive until pipeline finishes
    
    We want to make sure the recorder isn't finalized until the
    saved recording hits disk.  This means the pipeline object needs
    a hard reference on the recorder.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=680647

 src/shell-recorder.c |   16 +++-------------
 1 files changed, 3 insertions(+), 13 deletions(-)
---
diff --git a/src/shell-recorder.c b/src/shell-recorder.c
index 9dd7482..3a72ef5 100644
--- a/src/shell-recorder.c
+++ b/src/shell-recorder.c
@@ -269,18 +269,6 @@ static void
 shell_recorder_finalize (GObject  *object)
 {
   ShellRecorder *recorder = SHELL_RECORDER (object);
-  GSList *l;
-
-  for (l = recorder->pipelines; l; l = l->next)
-    {
-      RecorderPipeline *pipeline = l->data;
-
-      /* Remove the back-reference. The pipeline will be freed
-       * when it finishes. (Or when the process exits, but that's
-       * out of our control.)
-       */
-      pipeline->recorder = NULL;
-    }
 
   if (recorder->update_memory_used_timeout)
     g_source_remove (recorder->update_memory_used_timeout);
@@ -1344,6 +1332,8 @@ recorder_pipeline_free (RecorderPipeline *pipeline)
   if (pipeline->outfile != -1)
     close (pipeline->outfile);
 
+  g_clear_object (&pipeline->recorder);
+
   g_free (pipeline);
 }
 
@@ -1452,7 +1442,7 @@ recorder_open_pipeline (ShellRecorder *recorder)
   GstBus *bus;
 
   pipeline = g_new0(RecorderPipeline, 1);
-  pipeline->recorder = recorder;
+  pipeline->recorder = g_object_ref (recorder);
   pipeline->outfile = - 1;
 
   pipeline_description = recorder->pipeline_description;



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