aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickshadereffect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/items/qquickshadereffect.cpp')
-rw-r--r--src/quick/items/qquickshadereffect.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp
index 78458ce6b0..eb5256fa4e 100644
--- a/src/quick/items/qquickshadereffect.cpp
+++ b/src/quick/items/qquickshadereffect.cpp
@@ -515,6 +515,20 @@ QQuickShaderEffect::QQuickShaderEffect(QQuickItem *parent)
m_impl = new QQuickGenericShaderEffect(this, this);
}
+QQuickShaderEffect::~QQuickShaderEffect()
+{
+ // Delete the implementations now, while they still have have
+ // valid references back to us.
+#if QT_CONFIG(opengl)
+ auto *glImpl = m_glImpl;
+ m_glImpl = nullptr;
+ delete glImpl;
+#endif
+ auto *impl = m_impl;
+ m_impl = nullptr;
+ delete impl;
+}
+
/*!
\qmlproperty string QtQuick::ShaderEffect::fragmentShader
@@ -795,7 +809,8 @@ bool QQuickShaderEffect::event(QEvent *e)
return QQuickItem::event(e);
}
#endif
- m_impl->handleEvent(e);
+ if (m_impl)
+ m_impl->handleEvent(e);
return QQuickItem::event(e);
}