From e968acb6e6e561af24ad8f24e9b0309018916c0b Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Wed, 18 Nov 2009 22:58:15 +0000 Subject: [PATCH] better ownership and scriptvalue reusage svn path=/trunk/KDE/kdebase/runtime/; revision=1051166 --- .../javascript/simplebindings/filedialogproxy.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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"