summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2017-04-04 11:31:36 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2017-04-04 11:22:25 +0000
commit22e6942d5a673f873c3f018bd16ca42a1fafd58e (patch)
treefd2a9b4d7275aafa937588fbe836aafeb02d1374
parentac79513c9a78be998b150121bd6d3ae26ace7735 (diff)
Ensure Shader disconnects the destroyed listener from the context
cleanup() is never called. The signal must be disconnected nonetheless, otherwise bad things can happen. For example, with a Scene3D in a QQuickWidget the context will be destroyed at a different stage than with QQuickWindow, and Shader may already be destroyed at that stage. Task-number: QTBUG-52132 Change-Id: Icbc8fe0294e0fa6a33385f7d9a2f81ef9f514283 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r--src/render/materialsystem/shader.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/render/materialsystem/shader.cpp b/src/render/materialsystem/shader.cpp
index e534a1ffc..3ee00739d 100644
--- a/src/render/materialsystem/shader.cpp
+++ b/src/render/materialsystem/shader.cpp
@@ -72,6 +72,8 @@ Shader::~Shader()
{
// TO DO: ShaderProgram is leaked as of now
// Fix that taking care that they may be shared given a same dna
+ if (m_graphicsContext)
+ QObject::disconnect(m_contextConnection);
}
void Shader::cleanup()