multiqueue: fix potential crash on shutdown
authorTim-Philipp Müller <tim@centricular.com>
Tue, 14 Jun 2022 16:29:31 +0000 (17:29 +0100)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 14 Jun 2022 17:32:03 +0000 (17:32 +0000)
commite72434ba203aabbcd66247a13e0e2f263ef005dc
tree65c8c9b13135a0ce30809468e4bb1a5c03261667
parent64833d2f127477f0f24a3fc09c9fe695edca5b91
multiqueue: fix potential crash on shutdown

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>
subprojects/gstreamer/plugins/elements/gstmultiqueue.c