GNOME Bugzilla – Bug 339308
MiniObject arguments for virtual methods shouldn't have their refcount incremented
Last modified: 2006-04-28 17:55:16 UTC
When a GstMiniObject is an argument for a virtual method implemented in python, its refcount shouldn't be incremented when passing it along to the python method. The solution should be to: 1/ wrap it in a pygstminiobject (with pygstminiobject_new()) 2/ unref it once (gst_mini_object_unref()) 3/ call the python method 4/ ref the miniobject (gst_mini_object_ref()) 5/ decrement the refcount on the pygstminiobject (Py_DECREF())
This can be easily fixed by modifying the GstMiniObjectParam parameter used by the codegenerator and defined in arg-types.py. A patch follows with suggested fix
Created attachment 64055 [details] [review] patch to fix refcount issues with miniobject in virtual methods
Even with this patch I'm still encountering an incremented refcount (see the attached code). do_transform_ip method show that the refcount of passed buffer is 2, what makes the buffer unwritable.
Created attachment 64086 [details] Showcase for big refcount in BaseTransform.do_transform_ip
The refcount too big in do_transform_ip() is a problem in the C BaseTransform : #340045 Closing this bug since following is commited. 2006-04-28 Edward Hervey <edward@fluendo.com> * gst/arg-types.py: GstMiniObject used as virtual methods parameters should be unreffed before calling the method and the ref-ed. Added Params and Returns for const-gchar*, GType and gulong so the code generator can generate more virtual methods handlers/proxys.