Fix use-after-unref problem noticed by Josep Torra Valles, and run
authorJan Schmidt <thaytan@noraisin.net>
Thu, 22 Jan 2009 22:09:47 +0000 (22:09 +0000)
committerJan Schmidt <thaytan@noraisin.net>
Thu, 22 Jan 2009 22:09:47 +0000 (22:09 +0000)
gst-indent

gst/playback/gstplaybasebin.c

index 6374084..d3389df 100644 (file)
@@ -483,8 +483,9 @@ group_commit (GstPlayBaseBin * play_base_bin, gboolean fatal, gboolean subtitle)
 
     setup_substreams (play_base_bin);
     GST_DEBUG_OBJECT (play_base_bin, "Emitting signal");
-    res = GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin)->
-        setup_output_pads (play_base_bin, group);
+    res =
+        GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin)->setup_output_pads
+        (play_base_bin, group);
     GST_DEBUG_OBJECT (play_base_bin, "done");
 
     GROUP_UNLOCK (play_base_bin);
@@ -869,7 +870,6 @@ gen_preroll_element (GstPlayBaseBin * play_base_bin,
     id = gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (check_queue), preroll);
     GST_DEBUG_OBJECT (play_base_bin, "Attaching probe to pad %s:%s (%p)",
         GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
-    gst_object_unref (sinkpad);
     g_object_set_data (G_OBJECT (preroll), "probe", GINT_TO_POINTER (id));
 
     /* catch eos and flush events so that we can ignore underruns */
@@ -877,6 +877,8 @@ gen_preroll_element (GstPlayBaseBin * play_base_bin,
         preroll);
     g_object_set_data (G_OBJECT (preroll), "eos_probe", GINT_TO_POINTER (id));
 
+    gst_object_unref (sinkpad);
+
     /* When we connect this queue, it will start running and immediatly
      * fire an underrun. */
     g_signal_connect (G_OBJECT (preroll), "underrun",
@@ -1216,8 +1218,9 @@ probe_triggered (GstPad * pad, GstEvent * event, gpointer user_data)
       setup_substreams (play_base_bin);
       GST_DEBUG ("switching to next group %p - emitting signal", group);
       /* and signal the new group */
-      res = GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin)->
-          setup_output_pads (play_base_bin, group);
+      res =
+          GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin)->setup_output_pads
+          (play_base_bin, group);
 
       GROUP_UNLOCK (play_base_bin);