aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/qml/qml/v8/qv8qobjectwrapper.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/qml/qml/v8/qv8qobjectwrapper.cpp b/src/qml/qml/v8/qv8qobjectwrapper.cpp
index 58a7520297..627e453a77 100644
--- a/src/qml/qml/v8/qv8qobjectwrapper.cpp
+++ b/src/qml/qml/v8/qv8qobjectwrapper.cpp
@@ -926,12 +926,16 @@ static void FastValueSetterReadOnly(v8::Local<v8::String> property, v8::Local<v8
void QV8QObjectWrapper::WeakQObjectReferenceCallback(v8::Persistent<v8::Value> handle, void *wrapper)
{
Q_ASSERT(handle->IsObject());
- QV8QObjectResource *resource = v8_resource_check<QV8QObjectResource>(handle->ToObject());
+ v8::Handle<v8::Object> v8object = handle->ToObject();
+ QV8QObjectResource *resource = v8_resource_check<QV8QObjectResource>(v8object);
Q_ASSERT(resource);
static_cast<QV8QObjectWrapper*>(wrapper)->unregisterWeakQObjectReference(resource);
if (static_cast<QV8QObjectWrapper*>(wrapper)->deleteWeakQObject(resource, false)) {
- qPersistentDispose(handle); // dispose.
+ // dispose
+ v8object->SetExternalResource(0);
+ delete resource;
+ qPersistentDispose(handle);
} else {
handle.MakeWeak(0, WeakQObjectReferenceCallback); // revive.
}