gst/gstcaps.c: Make _static_caps_get() refcounting sane.

Original commit message from CVS:
* gst/gstcaps.c: (gst_static_caps_get), (gst_caps_to_string):
Make _static_caps_get() refcounting sane.

* gst/gstelement.c: (gst_element_set_state):
Add g_return_val_if_fail() to protect against segfaults.
This commit is contained in:
Wim Taymans 2005-08-22 14:35:42 +00:00
parent 33e36f56a4
commit d31c5ea1f6
3 changed files with 14 additions and 7 deletions

View file

@ -1,3 +1,11 @@
2005-08-22 Wim Taymans <wim@fluendo.com>
* gst/gstcaps.c: (gst_static_caps_get), (gst_caps_to_string):
Make _static_caps_get() refcounting sane.
* gst/gstelement.c: (gst_element_set_state):
Add g_return_val_if_fail() to protect against segfaults.
2005-08-22 Stefan Kost <ensonic@users.sf.net>
* docs/gst/tmpl/gstevent.sgml:

View file

@ -347,9 +347,9 @@ gst_caps_unref (GstCaps * caps)
*
* Converts a #GstStaticCaps to a #GstCaps.
*
* Returns: A pointer to the #GstCaps. Although you do not have a reference on
* the caps, the core will never drop its references. (The core has two
* references on the caps so it will be immutable.)
* Returns: A pointer to the #GstCaps. Unref after usage. Since the
* core holds an additional ref to the returned caps,
* use gst_caps_make_writable() on the returned caps to modify it.
*/
GstCaps *
gst_static_caps_get (GstStaticCaps * static_caps)
@ -372,11 +372,9 @@ gst_static_caps_get (GstStaticCaps * static_caps)
if (!ret) {
g_critical ("Could not convert static caps \"%s\"", static_caps->string);
}
/* and now that we return it to the user, keep a ref for ourselves. This
* makes the caps immutable... AND INVINCIBLE! WOULD YOU LIKE TO TRY MY
* IMMUTABLE CAPS STYLE? I AM A CAPS WARRIOR!!! */
gst_caps_ref (caps);
}
/* ref the caps, makes it not writable */
gst_caps_ref (caps);
return caps;
}

View file

@ -1765,6 +1765,7 @@ gst_element_set_state (GstElement * element, GstElementState state)
GstElementState pending;
GTimeVal tv;
g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_FAILURE);
/* get current element state, need to call the method so that
* we call the virtual method and subclasses can implement their