GNOME Bugzilla – Bug 338982
python refcounting problems in gstpad.override
Last modified: 2006-04-28 14:52:28 UTC
File: http://webcvs.freedesktop.org/gstreamer/gst-python/gst/gstpad.override?annotate=1.30 In _wrap_gst_pad_set_blocked_async: Line 1019: PySequence_GetItem returns a ref. We never drop this one. 1022, 1030: Here we ref the callback twice, once for PySequence_GetItem, once for BuildValue("O"). We just need one ref (for the tuple), so one of these is leaked. 1034: The data tuple is leaked here. This is a GStreamer C API problem -- we have no free function for pad_blocked data. You can't just free it when the first block() is called, because a pad can be blocked twice (e.g. if a flush happens after the first block). We leak refs in all error cases. In pad_block_callback_marshal: 980, 983, 998: We give away our ref to py_data on line 983, but we still unref it on 998. This is incorrect. 988: Complicated code for no purpose. py_userdata is a 2-tuple, as built on line 1030. No need to iterate. Attached patch fixes problems, please review.
Created attachment 63853 [details] [review] Patch to fix problems
Seems fine to me, commit after freeze.
2006-04-19 Andy Wingo <wingo@pobox.com> * gst/gstpad.override (pad_block_callback_marshal) (_wrap_gst_pad_set_blocked_async): Fix refcounting problems and indent. Fixes #338982