summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMäättä Antti <antti.maatta@qt.io>2018-02-05 13:42:52 +0200
committerJani Heikkinen <jani.heikkinen@qt.io>2018-02-08 07:24:50 +0000
commit31f424bb81cd2583920d3d521e1e01f01c2d28e2 (patch)
tree26b719bb263ded9d8819500588ce700982556c08
parent156afc0f9dad1c16ee9a0ed31307121941443491 (diff)
Fix crash in scene2d at shutdownv5.10.1
The resource manager policy for scene2d nodes has been changed so the scene2d constructor gets called multiple times at startup. That in turn increments render thread user counter every time. The cleanup code gets called for each instanciated QScene2D node so at shutdown the counter never reaches zero and the render thread is not closed properly. Change the implementation so that the counter gets incremented only when the render thread has been properly initialized. Task-number: QTBUG-66003 Change-Id: I33a5b1f407e65329776bcabe0b66ff049581a435 Reviewed-by: Svenn-Arne Dragly <svenn-arne.dragly@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com> (cherry picked from commit 564dfd87c5b1317dcf9fbc4d1c8d858c72513421) Reviewed-by: Antti Määttä <antti.maatta@qt.io>
-rw-r--r--src/quick3d/quick3dscene2d/items/scene2d.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/quick3d/quick3dscene2d/items/scene2d.cpp b/src/quick3d/quick3dscene2d/items/scene2d.cpp
index 4abc7cf42..1147abf68 100644
--- a/src/quick3d/quick3dscene2d/items/scene2d.cpp
+++ b/src/quick3d/quick3dscene2d/items/scene2d.cpp
@@ -123,7 +123,7 @@ Scene2D::Scene2D()
, m_mouseEnabled(true)
, m_renderPolicy(Qt3DRender::Quick::QScene2D::Continuous)
{
- renderThreadClientCount->fetchAndAddAcquire(1);
+
}
Scene2D::~Scene2D()
@@ -146,6 +146,8 @@ void Scene2D::initializeSharedObject()
return;
}
+ renderThreadClientCount->fetchAndAddAcquire(1);
+
renderThread->setObjectName(QStringLiteral("Scene2D::renderThread"));
m_renderThread = renderThread;
m_sharedObject->m_renderThread = m_renderThread;
@@ -413,10 +415,11 @@ void Scene2D::cleanup()
m_sharedObject->wake();
m_sharedObject = nullptr;
}
-
- renderThreadClientCount->fetchAndSubAcquire(1);
- if (renderThreadClientCount->load() == 0)
- renderThread->quit();
+ if (m_renderThread) {
+ renderThreadClientCount->fetchAndSubAcquire(1);
+ if (renderThreadClientCount->load() == 0)
+ renderThread->quit();
+ }
}