As documented, the ownership should be JavaScriptOwned, which means:
Keep the QObject alive if there's a parent or some other JS object is
referencing it.
Fixes three QJSEngine auto-tests
Change-Id: I75503273b34e78355b08526da591b8d307a1c6e6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
#include <qmutex.h>
#include <qwaitcondition.h>
#include <private/qqmlglobal_p.h>
+#include <qqmlengine.h>
#undef Q_D
#undef Q_Q
{
Q_D(QJSEngine);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(d);
+ QQmlEngine::setObjectOwnership(object, QQmlEngine::JavaScriptOwnership);
return new QJSValuePrivate(v4, QV4::QObjectWrapper::wrap(v4, object));
}