Don't qobject_cast an object being destructed
authorKent Hansen <kent.hansen@nokia.com>
Wed, 28 Mar 2012 14:27:08 +0000 (16:27 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 28 Mar 2012 16:04:04 +0000 (18:04 +0200)
qobject_cast will cause the object's virtual metaObject() function to
be called. Calling virtual functions in a destructor should be
avoided. (The qobject_cast fails, and the assert is triggered.)

Change-Id: I04a7604adb8884cd36731577303793c74c0a8673
Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
src/quick/items/qquickshadereffectnode.cpp

index c4b9184..be1fb29 100644 (file)
@@ -407,7 +407,6 @@ void QQuickShaderEffectNode::markDirtyTexture()
 
 void QQuickShaderEffectNode::textureProviderDestroyed(QObject *object)
 {
-    Q_ASSERT(qobject_cast<QSGTextureProvider *>(object));
     m_material.invalidateTextureProvider(static_cast<QSGTextureProvider *>(object));
 }