aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-13 17:48:42 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-15 20:12:26 +0000
commit9b36512b9453f429644b0c388d381f7a2fc0f825 (patch)
treee573f34053e3c15f9900bbe5c4a92695a2576896 /src/quick/scenegraph
parent733adcf32c1cce288435940c66846a51ad29a464 (diff)
Avoid illegal downcasts in texture and shader handling
Fixes bad type-cast during destruction when objects no longer has the full type they used to. Detected by UBSAN. Change-Id: I4867091901d70d5a882656834eb97a704def1751 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/quick/scenegraph')
-rw-r--r--src/quick/scenegraph/qsgcontext.cpp2
-rw-r--r--src/quick/scenegraph/qsgcontext_p.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp
index d9ed25c099..53648e352a 100644
--- a/src/quick/scenegraph/qsgcontext.cpp
+++ b/src/quick/scenegraph/qsgcontext.cpp
@@ -393,7 +393,7 @@ QSGTexture *QSGRenderContext::textureForFactory(QQuickTextureFactory *factory, Q
void QSGRenderContext::textureFactoryDestroyed(QObject *o)
{
m_mutex.lock();
- m_texturesToDelete << m_textures.take(static_cast<QQuickTextureFactory *>(o));
+ m_texturesToDelete << m_textures.take(o);
m_mutex.unlock();
}
diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h
index 6d70d7ef6b..282ce828af 100644
--- a/src/quick/scenegraph/qsgcontext_p.h
+++ b/src/quick/scenegraph/qsgcontext_p.h
@@ -194,7 +194,7 @@ protected:
QPointer<QSGContext> m_sg;
QMutex m_mutex;
- QHash<QQuickTextureFactory *, QSGTexture *> m_textures;
+ QHash<QObject *, QSGTexture *> m_textures;
QSet<QSGTexture *> m_texturesToDelete;
QHash<QString, QSGDistanceFieldGlyphCache *> m_glyphCaches;