qmlgloverlay: fix multiple elements with Qt 5.15

With Qt 5.15 multiple qmlgloverlay elements would produce:

ASSERT: "!m_gl->property(QSG_RENDERCONTEXT_PROPERTY).isValid()" in file /path/to/qt5/qtdeclarative/src/quick/scenegraph/qsgdefaultrendercontext.cpp, line 121

Workaround by setting the (seeminigly unused) property before
initialization.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/695>
This commit is contained in:
Matthew Waters 2020-08-10 15:49:55 +10:00
parent e9a0307b94
commit 625e56d3b4

View file

@ -634,6 +634,18 @@ void GstQuickRenderer::initializeGstGL ()
return;
}
GST_INFO ("current QOpenGLContext %p", QOpenGLContext::currentContext());
/* XXX: Avoid an assertion inside QSGDefaultRenderContext::initialize()
* from an unused (in this scenario) property when using multiple
* QQuickRenderControl's with the same QOpenGLContext.
*
* First noticed with Qt 5.15. Idea from:
* https://forum.qt.io/topic/55888/is-it-impossible-that-2-qquickrendercontrol-use-same-qopenglcontext/2
*
* ASSERT: "!m_gl->property(QSG_RENDERCONTEXT_PROPERTY).isValid()" in file /path/to/qt5/qtdeclarative/src/quick/scenegraph/qsgdefaultrendercontext.cpp, line 121
*/
m_sharedRenderData->m_context->setProperty("_q_sgrendercontext", QVariant());
m_renderControl->initialize(m_sharedRenderData->m_context);
/* 1. QAnimationDriver's are thread-specific