pulsesink: prevent race condition causing ref leak
authorRené Stadler <rene.stadler@nokia.com>
Wed, 29 Jun 2011 17:59:26 +0000 (20:59 +0300)
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Tue, 5 Jul 2011 14:36:17 +0000 (16:36 +0200)
commitae87731de5dc9a1f39edd2b4dd12db30ad1ff0fd
tree2f7098c8b3f84d3d2526958c73be338de33285b5
parentf8456e2a1aaa9ae3a146ffb2a4510bff581eb88d
pulsesink: prevent race condition causing ref leak

Since commit 8bfd80, gst_pulseringbuffer_stop doesn't wait for the
deferred call to be run before returning. This causes a race when
READY->NULL is executed shortly after, which stops the mainloop. This
leaks the element reference which is passed as userdata for the callback
(introduced in commit 7cf996, bug #614765).

The correct fix is to wait in READY->NULL for all outstanding calls to
be fired (since libpulse doesn't provide a DestroyNotify for the
userdata). We get rid of the reference passing from 7cf996 altogether,
since finalization from the callback would anyways lead to a deadlock.

Re-fixes bug #614765.
ext/pulse/pulsesink.c
ext/pulse/pulsesink.h