summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@theqtcompany.com>2016-02-11 13:19:08 +0200
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2016-02-11 11:29:36 +0000
commitc00f1090b2287d345e83699d6b414336227aaf91 (patch)
treee9a89f11de2b47531be33c67af3c2d3dd3b4825e /src
parentf669d1708c1009adc7d82d42bf550e0d971e827f (diff)
Fix texture using application crash at shutdown
Depending on order things are destroyed at shutdown, texture factory can get deleted before textures at shutdown. Textures notify factory at their destructor, which caused the crash. Changed factory pointer to a guarded one to avoid this. Change-Id: I032f066a9a77ef92c68c31e0552f880a8f0a90af Task-number: QTBUG-51045 Reviewed-by: Pasi Keränen <pasi.keranen@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/imports/qtcanvas3d/teximage3d.cpp5
-rw-r--r--src/imports/qtcanvas3d/teximage3d_p.h3
2 files changed, 5 insertions, 3 deletions
diff --git a/src/imports/qtcanvas3d/teximage3d.cpp b/src/imports/qtcanvas3d/teximage3d.cpp
index 652e8c2..8528d15 100644
--- a/src/imports/qtcanvas3d/teximage3d.cpp
+++ b/src/imports/qtcanvas3d/teximage3d.cpp
@@ -198,7 +198,7 @@ void CanvasTextureImage::cleanupNetworkReply()
CanvasTextureImage::~CanvasTextureImage()
{
- if (m_parentFactory)
+ if (!m_parentFactory.isNull())
m_parentFactory->handleImageDestroyed(this);
cleanupNetworkReply();
delete[] m_pixelCache;
@@ -257,7 +257,8 @@ void CanvasTextureImage::load()
return;
setImageState(LOADING);
- m_parentFactory->handleImageLoadingStarted(this);
+ if (!m_parentFactory.isNull())
+ m_parentFactory->handleImageLoadingStarted(this);
emit imageLoadingStarted(this);
QNetworkRequest request(m_source);
diff --git a/src/imports/qtcanvas3d/teximage3d_p.h b/src/imports/qtcanvas3d/teximage3d_p.h
index 6789a2e..59bd0d6 100644
--- a/src/imports/qtcanvas3d/teximage3d_p.h
+++ b/src/imports/qtcanvas3d/teximage3d_p.h
@@ -51,6 +51,7 @@
#include "abstractobject3d_p.h"
#include <QtCore/QUrl>
+#include <QtCore/QPointer>
#include <QtGui/QImage>
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkReply>
@@ -159,7 +160,7 @@ private:
bool m_pixelCacheFlipY;
QImage m_glImage;
QVariant *m_anyValue;
- CanvasTextureImageFactory *m_parentFactory;
+ QPointer<CanvasTextureImageFactory> m_parentFactory;
};
QT_CANVAS3D_END_NAMESPACE