glbasefilter: gst_gl_base_filter_gl_start() tries to use a NULL context
My app is quickly creating and destroying playbin
pipelines which are using gtkglsink
and glsinkbin
as video sink. This is a bug on my side but by doing so I raised a crash in glbasefilter
.
#0 0x00007f6dab4678bb in gst_gl_insert_debug_marker (context=0x0, format=format@entry=0x7f6dab492e52 "starting element %s") at ../subprojects/gst-plugins-base/gst-libs/gst/gl/gstgldebug.c:387
#1 0x00007f6dab45c3d6 in gst_gl_base_filter_gl_start (context=<optimized out>, data=<optimized out>) at ../subprojects/gst-plugins-base/gst-libs/gst/gl/gstglbasefilter.c:283
#2 0x00007f6dab4839f3 in _run_message_sync (message=0x7f6d92172470) at ../subprojects/gst-plugins-base/gst-libs/gst/gl/gstglwindow.c:573
#3 0x00007f6dab483992 in _run_message_async (message=0x564e9b769060) at ../subprojects/gst-plugins-base/gst-libs/gst/gl/gstglwindow.c:640
#4 0x00007f6dc14e197b in () at /lib64/libglib-2.0.so.0
#5 0x00007f6dc14e506d in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
#6 0x00007f6dc14e5438 in () at /lib64/libglib-2.0.so.0
#7 0x00007f6dc14e5762 in g_main_loop_run () at /lib64/libglib-2.0.so.0
#8 0x00007f6dab483a75 in gst_gl_window_default_run (window=0x564e9b917d80) at ../subprojects/gst-plugins-base/gst-libs/gst/gl/gstglwindow.c:499
#9 0x00007f6dab466d10 in gst_gl_context_create_thread (context=0x7f6dac007af0) at ../subprojects/gst-plugins-base/gst-libs/gst/gl/gstglcontext.c:1305
#10 0x00007f6dc150e2aa in () at /lib64/libglib-2.0.so.0
#11 0x00007f6dc121458e in start_thread () at /lib64/libpthread.so.0
#12 0x00007f6dc1128683 in clone () at /lib64/libc.so.6
As you can see when gst_gl_base_filter_gl_start
is called as a callback filter->context
is NULL
.
I checked and gst_gl_base_filter_reset
is called between the gst_gl_context_thread_add
and the callback.
The obvious fix would to early return in context
is NULL
but I'm not familiar enough with gl threading system so I'm not sure if that's the proper way to fix this.
I suspect gst_gl_base_filter_gl_stop
may suffer the same bug. Especially as context
is set to NULL
right after invoking it.