After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 338982 - python refcounting problems in gstpad.override
python refcounting problems in gstpad.override
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-python
git master
Other Linux
: Normal normal
: 0.10.5
Assigned To: Edward Hervey
Johan (not receiving bugmail) Dahlin
Depends on:
Blocks:
 
 
Reported: 2006-04-19 09:13 UTC by Andy Wingo
Modified: 2006-04-28 14:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to fix problems (3.71 KB, patch)
2006-04-19 09:14 UTC, Andy Wingo
committed Details | Review

Description Andy Wingo 2006-04-19 09:13:14 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.
Comment 1 Andy Wingo 2006-04-19 09:14:39 UTC
Created attachment 63853 [details] [review]
Patch to fix problems
Comment 2 Edward Hervey 2006-04-19 09:31:35 UTC
Seems fine to me, commit after freeze.
Comment 3 Edward Hervey 2006-04-28 14:52:28 UTC
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