More fixes for QDeclarativeListModelWorkerAgent cleanup
authorCharles Yin <charles.yin@nokia.com>
Tue, 7 Feb 2012 02:06:49 +0000 (12:06 +1000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 7 Feb 2012 02:55:42 +0000 (03:55 +0100)
1) Use deleteLater() instead of delete to avoid crashing with any pending events
2) During event processing, return earlier if possible

Change-Id: Ia7d6c95acf1175a16b80e952b95909bb5bbc9433
Reviewed-by: Glenn Watson <glenn.watson@nokia.com>
Reviewed-by: Martin Jones <martin.jones@nokia.com>

src/declarative/qml/qdeclarativelistmodelworkeragent.cpp

index 3ae1b32..51ac460 100644 (file)
@@ -114,7 +114,7 @@ void QDeclarativeListModelWorkerAgent::release()
     bool del = !m_ref.deref();
 
     if (del)
-        delete this;
+        deleteLater();
 }
 
 void QDeclarativeListModelWorkerAgent::modelDestroyed()
@@ -236,6 +236,7 @@ bool QDeclarativeListModelWorkerAgent::event(QEvent *e)
 
         if (cc)
             emit m_orig->countChanged();
+        return true;
     }
 
     return QObject::event(e);