diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2022-11-02 11:19:55 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2022-11-03 15:56:07 +0100 |
commit | d7d44783cee166e0dd0c24b56478ab6d4c0c6cdc (patch) | |
tree | 14ba14ef7fa64c811028143a510401e661786d30 /src/quick/scenegraph/qsgthreadedrenderloop.cpp | |
parent | 81b6cc7ebbce8289f2d465fe6c3585a7fd7a0a4a (diff) |
Make QSGRhiShaderEffectMaterial::type() safe with multiple windows
The history of this mechanism goes back to early 5.0 days probably,
when the case of showing multiple QQuickWindows was not always
considered. Using a single data storage is not only unsafe when
it comes to threading (if using the threaded render loop), but
seems to cause visible rendering errors if certain conditions are
met. (the problem is not strictly caused by emptying the list of
QSGMaterialType pointers when a window goes away, that's safe in
itself, but rather there is a chance of collisions then if 'new'
gives the same pointer afterwards, breaking the uniqueness
contract; or something along those lines)
This is now solved by locking and making the storage per window,
using the QQuickWindow as the key.
Pick-to: 6.2 6.4
Fixes: QTBUG-107818
Change-Id: I4f94c4bccb43c4db246aff02e0b809cc9f106e39
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/scenegraph/qsgthreadedrenderloop.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index 1acb59e80e..e66e02b725 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -482,7 +482,7 @@ void QSGRenderThread::invalidateGraphics(QQuickWindow *window, bool inDestructor if (wipeSG) { dd->cleanupNodesOnShutdown(); #if QT_CONFIG(quick_shadereffect) - QSGRhiShaderEffectNode::cleanupMaterialTypeCache(); + QSGRhiShaderEffectNode::cleanupMaterialTypeCache(window); #endif } else { qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- persistent SG, avoiding cleanup"); |