Segmentation fault in QtGLVideoItem::onSceneGraphInitialized (ext/qt/qtitem.cc:695)
I'm migrating from QtMultimedia to GstGLVideoItem. Using 1.22.1 on Debian 11 amd64.
I sometimes get this crash while, it seems, QML scene is being initialized?
#0 QtGLVideoItem::onSceneGraphInitialized (this=0x555ce25e29e0) at ../source_subfolder/ext/qt/qtitem.cc:695
#1 0x00007f2120d22ad9 in std::__invoke_impl<void, void (QtGLVideoItem::*&)(), QtGLVideoItem*&> (__f=@0x555ce24d3ec0: (void (QtGLVideoItem::*)(QtGLVideoItem * const)) 0x7f2120d20356 <QtGLVideoItem::onSceneGraphInitialized()>, __t=@0x555ce24d3ed0: 0x555ce25e29e0)
at /usr/include/c++/10/bits/invoke.h:73
#2 0x00007f2120d22a35 in std::__invoke<void (QtGLVideoItem::*&)(), QtGLVideoItem*&> (__fn=@0x555ce24d3ec0: (void (QtGLVideoItem::*)(QtGLVideoItem * const)) 0x7f2120d20356 <QtGLVideoItem::onSceneGraphInitialized()>) at /usr/include/c++/10/bits/invoke.h:95
#3 0x00007f2120d229be in std::_Bind<void (QtGLVideoItem::*(QtGLVideoItem*))()>::__call<void, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) (this=0x555ce24d3ec0, __args=...) at /usr/include/c++/10/functional:416
#4 0x00007f2120d22950 in std::_Bind<void (QtGLVideoItem::*(QtGLVideoItem*))()>::operator()<, void>() (this=0x555ce24d3ec0) at /usr/include/c++/10/functional:499
#5 0x00007f2120d2289c in std::__invoke_impl<void, std::_Bind<void (QtGLVideoItem::*(QtGLVideoItem*))()>&>(std::__invoke_other, std::_Bind<void (QtGLVideoItem::*(QtGLVideoItem*))()>&) (__f=...) at /usr/include/c++/10/bits/invoke.h:60
#6 0x00007f2120d22709 in std::__invoke_r<void, std::_Bind<void (QtGLVideoItem::*(QtGLVideoItem*))()>&>(std::_Bind<void (QtGLVideoItem::*(QtGLVideoItem*))()>&) (__fn=...) at /usr/include/c++/10/bits/invoke.h:153
#7 0x00007f2120d22485 in std::_Function_handler<void (), std::_Bind<void (QtGLVideoItem::*(QtGLVideoItem*))()> >::_M_invoke(std::_Any_data const&) (__functor=...) at /usr/include/c++/10/bits/std_function.h:291
#8 0x00007f2120d21eb0 in std::function<void ()>::operator()() const (this=0x555ce3720c80) at /usr/include/c++/10/bits/std_function.h:622
#9 0x00007f2120d21c26 in RenderJob::run (this=0x555ce3720c70) at ../source_subfolder/ext/qt/gstqtglutility.h:37
#10 0x00007f2128ce6871 in QQuickWindowPrivate::runAndClearJobs(QList<QRunnable*>*) () from /home/user/myapp/lib/libQt5Quick.so.5
#11 0x00007f2128ce762a in QQuickWindowPrivate::syncSceneGraph() () from /home/user/myapp/lib/libQt5Quick.so.5
#12 0x00007f2128c8c5f5 in QSGRenderThread::sync(bool, bool) () from /home/user/myapp/lib/libQt5Quick.so.5
#13 0x00007f2128c8ea31 in QSGRenderThread::syncAndRender(QImage*) () from /home/user/myapp/lib/libQt5Quick.so.5
#14 0x00007f2128c9238b in QSGRenderThread::run() () from /home/user/myapp/lib/libQt5Quick.so.5
#15 0x00007f212633545d in QThreadPrivate::start(void*) () from /home/user/myapp/lib/libQt5Core.so.5
#16 0x00007f2128268ea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#17 0x00007f2125e7ba2f in clone () from /lib/x86_64-linux-gnu/libc.so.6
It happens here: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/3ab8a0bc3ef642f01fe7152cf08bb06d21419677/subprojects/gst-plugins-good/ext/qt/qtitem.cc#L695
But if I raise GST_DEBUG level, I get crash earlier, on the attempt to log message: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/3ab8a0bc3ef642f01fe7152cf08bb06d21419677/subprojects/gst-plugins-good/ext/qt/qtitem.cc#L692
So I assume that it's bug because case when this->window()->openglContext()
is null is not handled?
This reproduces easily in our complex QML application (it's SwipeView with Repeater and Loaders...) on "weaker" Celeron-based machine, and rarer on i7 one. So I guess it's sort of race condition?