qt(6)/material: ensure that we always update the context in setBuffer()
authorMatthew Waters <matthew@centricular.com>
Fri, 22 Nov 2024 07:59:53 +0000 (18:59 +1100)
committerBackport Bot <gitlab-backport-bot@gstreamer-foundation.org>
Wed, 27 Nov 2024 01:19:27 +0000 (01:19 +0000)
commit9e737b1ff200afae0c5b8df4042220014a49a0ac
treee24a51c96a11f3a143cd393cb0d3c5e6b7aedeb0
parent879008d3648dc7697cd96f846c9a70c7d43e7ecf
qt(6)/material: ensure that we always update the context in setBuffer()

Scenario is that there are two (or more) GstGLContext's wrapping Qt's GL
context from either multiple qml(6)glsink or qml(6)glsrc elements.  Call flow is this:

1. material 1 setBuffer()
2. material 1 bind()
3. material 2 setBuffer()
4. material 2 bind()

If the call to setBuffer() reuses the same buffer as previous call, then the
qt context is not updated in the material.  If however the previously used qt
context by the material had been deactivated or freed, then bind() would fail
and could result in a critical like so:

gst_gl_context_thread_add: assertion 'context->priv->active_thread == g_thread_self ()' failed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7978>
subprojects/gst-plugins-good/ext/qt/gstqsgmaterial.cc
subprojects/gst-plugins-good/ext/qt6/gstqsg6material.cc