Ensure all persistent handles are disposed properly
authorChris Adams <christopher.adams@nokia.com>
Wed, 5 Oct 2011 07:37:12 +0000 (17:37 +1000)
committerQt by Nokia <qt-info@nokia.com>
Wed, 5 Oct 2011 08:41:32 +0000 (10:41 +0200)
Previously, some handles were leaking, which was causing a dramatic
slowdown in v8 gc speed over time.

Change-Id: I1e8d674b48647b7a0063a4b1c8d83130795502a0
Reviewed-on: http://codereview.qt-project.org/6026
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>

src/declarative/qml/qdeclarativesqldatabase.cpp
src/declarative/qml/v8/qv8engine.cpp
src/declarative/qml/v8/qv8gccallback_p.h

index 687aec9..7fc6207 100644 (file)
@@ -197,6 +197,7 @@ QDeclarativeSqlDatabaseData::~QDeclarativeSqlDatabaseData()
 {
     qPersistentDispose(constructor);
     qPersistentDispose(queryConstructor);
+    qPersistentDispose(rowsConstructor);
 }
 
 static QString qmlsqldatabase_databasesPath(QV8Engine *engine)
index 33c87b7..5259ab1 100644 (file)
@@ -1390,6 +1390,11 @@ QV8GCCallback::Node::~Node()
     node.remove();
 }
 
+QV8GCCallback::Referencer::~Referencer()
+{
+    qPersistentDispose(strongReferencer);
+}
+
 QV8GCCallback::Referencer::Referencer()
 {
     v8::HandleScope handleScope;
index 095c0e5..f5f7d8b 100644 (file)
@@ -70,7 +70,7 @@ public:
 
     class Referencer {
     public:
-        ~Referencer() {}
+        ~Referencer();
         void addRelationship(QObject *object, v8::Persistent<v8::Value> handle);
         void addRelationship(QObject *object, QObject *other);
     private: