diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-05-11 20:42:59 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-05-13 14:12:57 +0200 |
commit | 85a126c288c608132e6254a51f43a0146d380fef (patch) | |
tree | 20c3853fdf29bfb50c81e98c72a38cd529a47339 /src/quick/scenegraph/qsgrhishadereffectnode_p.h | |
parent | 525fe67ac2eefd37c1758a64fc519e9886475983 (diff) |
rhi: Fix crashing Controls autotests due to shadereffect lifetime issues
Make the QSGShaderEffectNode base class a QObject, the subclass
(QSGRhiShaderEffectNode) is already a QObject so we lose nothing.
This way we can get rid of the textureChanged() signal from the
shadereffectmanager (the object living on the gui thread), and so the
node (living on the render thread) does not need to do emit
m_mgr->textureChanged() on the render thread. The signal emission in
itself was perfectly fine, except when m_mgr happened to be destroyed
already in case the node outlived the gui thread's item (and m_mgr).
After the change we have something that is closer to what the direct
OpenGL implementation did - and some of the interfaces in QSGContext get
a lot cleaner in fact because the node can be instantiated on its own,
without the involving the shadereffectmanager object that does not even
live on the render thread.
Change-Id: Ibb918cc3eaa08faddb8b8e5dfa3e34b212161703
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/quick/scenegraph/qsgrhishadereffectnode_p.h')
-rw-r--r-- | src/quick/scenegraph/qsgrhishadereffectnode_p.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/quick/scenegraph/qsgrhishadereffectnode_p.h b/src/quick/scenegraph/qsgrhishadereffectnode_p.h index 26460d24b2..fb98bbf10e 100644 --- a/src/quick/scenegraph/qsgrhishadereffectnode_p.h +++ b/src/quick/scenegraph/qsgrhishadereffectnode_p.h @@ -59,7 +59,6 @@ QT_BEGIN_NAMESPACE class QSGDefaultRenderContext; class QSGPlainTexture; class QSGRhiShaderEffectNode; -class QSGRhiGuiThreadShaderEffectManager; class QFileSelector; class QSGRhiShaderLinker @@ -121,12 +120,12 @@ public: QSGPlainTexture *m_dummyTexture = nullptr; }; -class QSGRhiShaderEffectNode : public QObject, public QSGShaderEffectNode +class QSGRhiShaderEffectNode : public QSGShaderEffectNode { Q_OBJECT public: - QSGRhiShaderEffectNode(QSGDefaultRenderContext *rc, QSGRhiGuiThreadShaderEffectManager *mgr); + QSGRhiShaderEffectNode(QSGDefaultRenderContext *rc); QRectF updateNormalizedTextureSubRect(bool supportsAtlasTextures) override; void syncMaterial(SyncData *syncData) override; @@ -140,7 +139,6 @@ private Q_SLOTS: private: QSGDefaultRenderContext *m_rc; - QSGRhiGuiThreadShaderEffectManager *m_mgr; QSGRhiShaderEffectMaterial m_material; }; |