commit 23c3458d90ca622dcc96f32696e95942776cc103 Author: Sjoerd Simons Date: Sat Mar 29 17:23:32 2008 +0100 * src/rbgst-element-factory.c: The conversion to a ruby object gets one extra reference, but gst_factory_make already gives us one. So drop the extra to ensure correct refcounting. diff --git a/gstreamer/src/rbgst-element-factory.c b/gstreamer/src/rbgst-element-factory.c index f50011c..e8f38f3 100644 --- a/gstreamer/src/rbgst-element-factory.c +++ b/gstreamer/src/rbgst-element-factory.c @@ -52,15 +52,21 @@ rb_gst_elementfactory_make (int argc, VALUE *argv, VALUE self) { GstElement *element; VALUE fname, ename; + VALUE ret; rb_scan_args (argc, argv, "11", &fname, &ename); element = gst_element_factory_make (RVAL2CSTR(fname), NIL_P (ename) ? NULL : RVAL2CSTR (ename)); - return element != NULL - ? RGST_ELEMENT_NEW (element) - : Qnil; + if (element == NULL) + return Qnil; + + /* This add another ref to the element, but it was already ours so + * unref it again */ + ret = GOBJ2RVAL(element); + gst_object_unref (element); + return ret; } /*