validate: unref copied and pasted
authorHenry Wilkes <hwilkes@igalia.com>
Fri, 20 Dec 2019 12:30:54 +0000 (12:30 +0000)
committerThibault Saunier <tsaunier@igalia.com>
Thu, 5 Mar 2020 19:59:37 +0000 (16:59 -0300)
ges/ges-validate.c

index 3da79fd..99dee95 100644 (file)
@@ -806,7 +806,12 @@ _copy_element (GstValidateScenario * scenario, GstValidateAction * action)
 
   copied = ges_timeline_element_copy (element, recursive);
   pasted = ges_timeline_element_paste (copied, position);
+  /* `copied` is only used for the single paste operation, and is not
+   * actually in any timeline. We own it (it is actually still floating).
+   * `pasted` is the actual new object in the timeline. We own a
+   * reference to it. */
   gst_object_unref (timeline);
+  gst_object_unref (copied);
 
   if (!pasted) {
     GST_VALIDATE_REPORT_ACTION (scenario, action,
@@ -822,9 +827,11 @@ _copy_element (GstValidateScenario * scenario, GstValidateAction * action)
           g_quark_from_string ("scenario::execution-error"),
           "Could not set element name %s", paste_name);
 
+      gst_object_unref (pasted);
       return GST_VALIDATE_EXECUTE_ACTION_ERROR_REPORTED;
     }
   }
+  gst_object_unref (pasted);
 
   return GST_VALIDATE_EXECUTE_ACTION_OK;
 }