The mq we get out of the weak ref might be NULL if we're
shutting down, which could cause assertion failures or
crashes.
It might also cause miscompilations where the compiler just
optimises away the NULL check because it jumps to a code path
that then dereferences the pointer which clearly isn't going
to work. Seems like something like this happens with gcc 11.
Fixes #1262
Co-authored-by: Doug Nazar <nazard@nazar.ca>
Co-authored-by: Sebastian Dröge <sebastian@centricular.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2599>
srcpad = g_weak_ref_get (&sq->srcpad);
if (!mq || !srcpad)
- goto out_flushing;
+ goto done;
next:
GST_DEBUG_OBJECT (mq, "SingleQueue %d : trying to pop an object", sq->id);
mq = g_weak_ref_get (&sq->mqueue);
if (!mq)
- goto flushing;
+ goto done;
/* if eos, we are always full, so avoid hanging incoming indefinitely */
if (sq->is_eos)