GNOME Bugzilla – Bug 383382
Removing pads from collectpads not threadsafe
Last modified: 2006-12-16 15:20:28 UTC
Hi, removing a pad from collectpads while playing. The remove_pad function frees a the to-be-removed pad's private data, while the _chain function of that pad could still be using it.
Created attachment 77895 [details] [review] Add basic refcounting to collect pads data This patch adds some basic refcounting the the pads data to ensure it's only freed when nothing is using it anymore. With this patch and the one from #383043 i can continously add and remove pads from a videomixer while playing without problems.
Commited. There is still a race in the code when a pad is removed right after it got collected, no buffer was consumed and after the check for removed but before the _WAIT call (I marked it in the source with a FIXME). The only way to fix this is to seriously rethink the locking, it's getting really messy.. Patch by: Sjoerd Simons <sjoerd at luon dot net> * libs/gst/base/gstcollectpads.c: (ref_data), (unref_data), (gst_collect_pads_add_pad), (gst_collect_pads_remove_pad), (gst_collect_pads_stop), (gst_collect_pads_event), (gst_collect_pads_chain): * libs/gst/base/gstcollectpads.h: Add refcounting to the collectpads data so we can track when it's safe to free the data. Fixes #383382.