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 383382 - Removing pads from collectpads not threadsafe
Removing pads from collectpads not threadsafe
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 0.10.12
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-12-07 14:55 UTC by Sjoerd Simons
Modified: 2006-12-16 15:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add basic refcounting to collect pads data (4.81 KB, patch)
2006-12-07 14:58 UTC, Sjoerd Simons
committed Details | Review

Description Sjoerd Simons 2006-12-07 14:55:56 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.
Comment 1 Sjoerd Simons 2006-12-07 14:58:55 UTC
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.
Comment 2 Wim Taymans 2006-12-16 15:20:28 UTC
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.