History

Work on fixing V8 memory leaks, memory leak test

ksuprynowicz committed 3 years ago

Commit 42704ea1 parent f016a199 files · +46 −3Browse files

Showing the changes to libraries/script-engine/src/v8/ScriptEngineV8_cast.cpp (1 of 9 files). Show all

Unified · Split

libraries/script-engine/src/v8/ScriptEngineV8_cast.cpp+3−1
@@ -750,6 +750,7 @@ V8ScriptValue ScriptEngineV8::castVariantToValue(const QVariant& val) { · 749 unmodified lines
750 case QMetaType::QObjectStar: {750 case QMetaType::QObjectStar: {
751 QObject* obj = val.value<QObject*>();751 QObject* obj = val.value<QObject*>();
752 if (obj == nullptr) return V8ScriptValue(this, v8::Null(_v8Isolate));752 if (obj == nullptr) return V8ScriptValue(this, v8::Null(_v8Isolate));
753 //V8TODO: what should be the ownership in this case?
753 return ScriptObjectV8Proxy::newQObject(this, obj);754 return ScriptObjectV8Proxy::newQObject(this, obj);
754 }755 }
755 case QMetaType::QDateTime:756 case QMetaType::QDateTime:
@@ -768,9 +769,10 @@ V8ScriptValue ScriptEngineV8::castVariantToValue(const QVariant& val) { · 12 unmodified lines
768 if (QMetaType::typeFlags(valTypeId) & (QMetaType::PointerToQObject | QMetaType::TrackingPointerToQObject)) {769 if (QMetaType::typeFlags(valTypeId) & (QMetaType::PointerToQObject | QMetaType::TrackingPointerToQObject)) {
769 QObject* obj = val.value<QObject*>();770 QObject* obj = val.value<QObject*>();
770 if (obj == nullptr) return V8ScriptValue(this, v8::Null(_v8Isolate));771 if (obj == nullptr) return V8ScriptValue(this, v8::Null(_v8Isolate));
772 //V8TODO: what should be the ownership in this case?
771 return ScriptObjectV8Proxy::newQObject(this, obj);773 return ScriptObjectV8Proxy::newQObject(this, obj);
772 }774 }
773 // have we set a prototype'd variant?775 // have we set a prototyped variant?
774 {776 {
775 _customTypeProtect.lockForRead();777 _customTypeProtect.lockForRead();
776 CustomPrototypeMap::const_iterator lookup = _customPrototypes.find(valTypeId);778 CustomPrototypeMap::const_iterator lookup = _customPrototypes.find(valTypeId);