From 5af16fb4dfa39ead82240f5ffbc004634f3c288f Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 27 May 2019 16:32:00 +0200 Subject: Fix mistakes in 9b36512b9453f429644b0c388d381f7a2fc0f825 Undo change to signature of textureProviderDestroyed, and reinstate test for disconnected item having a window, and instead ensure we are destroyed earlier while the item is still valid. Fixes: QTBUG-76055 Change-Id: I0c6c13cd44d3364984e0245b3b048f4aa183b43a Reviewed-by: Daniel Smith Reviewed-by: Simon Hausmann --- src/quick/items/qquickshadereffect.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/quick/items/qquickshadereffect.cpp') diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp index 05d9e5e36d..3721731f68 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 -- cgit v1.2.3