diff --git a/scriptengines/javascript/simplebindings/filedialogproxy.cpp b/scriptengines/javascript/simplebindings/filedialogproxy.cpp index d7058522a..dc000750e 100644 --- a/scriptengines/javascript/simplebindings/filedialogproxy.cpp +++ b/scriptengines/javascript/simplebindings/filedialogproxy.cpp @@ -133,7 +133,8 @@ Q_DECLARE_METATYPE(FileDialogProxy *) typedef FileDialogProxy* FileDialogProxyPtr; QScriptValue qScriptValueFromFileDialogProxy(QScriptEngine *engine, const FileDialogProxyPtr &fd) { - return engine->newQObject(const_cast(fd)); + return engine->newQObject(const_cast(fd), QScriptEngine::AutoOwnership, + QScriptEngine::PreferExistingWrapperObject | QScriptEngine::ExcludeSuperClassContents); } void fileDialogProxyFromQScriptValue(const QScriptValue &scriptValue, FileDialogProxyPtr &fd) @@ -158,7 +159,7 @@ QScriptValue FileDialogProxy::fileDialogSave(QScriptContext *context, QScriptEng } FileDialogProxy *fd = new FileDialogProxy(KFileDialog::Saving, parent); - return engine->newQObject(fd, QScriptEngine::ScriptOwnership, QScriptEngine::ExcludeSuperClassContents); + return engine->newQObject(fd, QScriptEngine::AutoOwnership, QScriptEngine::ExcludeSuperClassContents); } QScriptValue FileDialogProxy::fileDialogOpen(QScriptContext *context, QScriptEngine *engine) @@ -169,7 +170,7 @@ QScriptValue FileDialogProxy::fileDialogOpen(QScriptContext *context, QScriptEng } FileDialogProxy *fd = new FileDialogProxy(KFileDialog::Opening, parent); - return engine->newQObject(fd, QScriptEngine::ScriptOwnership, QScriptEngine::ExcludeSuperClassContents); + return engine->newQObject(fd, QScriptEngine::AutoOwnership, QScriptEngine::ExcludeSuperClassContents); } #include "filedialogproxy.moc"