diff --git a/ChangeLog b/ChangeLog index 594f7e255d..d22708ad35 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-08-22 Wim Taymans + + * 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 * docs/gst/tmpl/gstevent.sgml: diff --git a/gst/gstcaps.c b/gst/gstcaps.c index 6a78b2a4e0..e9f16d5d32 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -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; } diff --git a/gst/gstelement.c b/gst/gstelement.c index 790ec55558..a7bccdd970 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -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