summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2021-07-13 21:38:10 +1000
committerMatthew Waters <matthew@centricular.com>2021-07-15 14:10:04 +1000
commitfdca97eca839d4e6c365ab98e8f8f6d877f860f1 (patch)
tree3fadccb46bd71e00e32a3c74783dea23840b39c7 /gst
parentbc6b68215f1a9a83a3018fb351451701e22ec0ce (diff)
downloadgstreamer-plugins-bad-fdca97eca839d4e6c365ab98e8f8f6d877f860f1.tar.gz
rtmp2src: workaround a GLib race when destroying a GMainContext/GSource
https://gitlab.gnome.org/GNOME/glib/-/issues/803 Basically, if destruction of a GSource and its associated GMainContext are not synchronised, Then the GSource destruction can access freed GMainContext resources and cause a crash. This is not super common but can happen. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2405>
Diffstat (limited to 'gst')
-rw-r--r--gst/rtmp2/gstrtmp2src.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gst/rtmp2/gstrtmp2src.c b/gst/rtmp2/gstrtmp2src.c
index 6cad882ff..960e2da5c 100644
--- a/gst/rtmp2/gstrtmp2src.c
+++ b/gst/rtmp2/gstrtmp2src.c
@@ -691,11 +691,14 @@ gst_rtmp2_src_create (GstBaseSrc * src, guint64 offset, guint size,
return GST_FLOW_OK;
out:
- g_mutex_unlock (&self->lock);
if (timeout) {
g_source_destroy (timeout);
g_source_unref (timeout);
}
+ /* Keep the unlock after the destruction of the timeout source to workaround
+ * https://gitlab.gnome.org/GNOME/glib/-/issues/803
+ */
+ g_mutex_unlock (&self->lock);
return ret;
}