Merge branch 'upstream/1.22.7' into tizen_gst_1.22.7
[platform/upstream/gstreamer.git] / subprojects / gstreamer / gst / gstbin.c
index 4f22c1e..00761f3 100644 (file)
@@ -1577,8 +1577,10 @@ gst_bin_remove_func (GstBin * bin, GstElement * element)
   GST_OBJECT_LOCK (element);
   elem_name = g_strdup (GST_ELEMENT_NAME (element));
 
-  if (GST_OBJECT_PARENT (element) != GST_OBJECT_CAST (bin))
+  if (GST_OBJECT_PARENT (element) != GST_OBJECT_CAST (bin)) {
+    GST_OBJECT_UNLOCK (element);
     goto not_in_bin;
+  }
 
   /* remove the parent ref */
   GST_OBJECT_PARENT (element) = NULL;
@@ -1829,7 +1831,6 @@ no_state_recalc:
   /* ERROR handling */
 not_in_bin:
   {
-    GST_OBJECT_UNLOCK (element);
     GST_OBJECT_UNLOCK (bin);
     GST_WARNING_OBJECT (bin, "Element '%s' is not in bin", elem_name);
     g_free (elem_name);