caps: only add the structure when we could set the parent
authorWim Taymans <wim.taymans@collabora.co.uk>
Mon, 16 May 2011 16:12:33 +0000 (18:12 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 16 May 2011 16:12:33 +0000 (18:12 +0200)
gst/gstcaps.c

index 27feca2..96033c5 100644 (file)
@@ -96,8 +96,8 @@
 /* quick way to append a structure without checking the args */
 #define gst_caps_append_structure_unchecked(caps, structure) G_STMT_START{\
   GstStructure *__s=structure;                                      \
-  gst_structure_set_parent_refcount (__s, &GST_MINI_OBJECT_REFCOUNT(caps));         \
-  g_ptr_array_add (caps->structs, __s);                             \
+  if (gst_structure_set_parent_refcount (__s, &GST_MINI_OBJECT_REFCOUNT(caps)))         \
+    g_ptr_array_add (caps->structs, __s);                             \
 }G_STMT_END
 
 /* lock to protect multiple invocations of static caps to caps conversion */