better ownership and scriptvalue reusage
svn path=/trunk/KDE/kdebase/runtime/; revision=1051166
This commit is contained in:
parent
6bce51466f
commit
e968acb6e6
@ -133,7 +133,8 @@ Q_DECLARE_METATYPE(FileDialogProxy *)
|
|||||||
typedef FileDialogProxy* FileDialogProxyPtr;
|
typedef FileDialogProxy* FileDialogProxyPtr;
|
||||||
QScriptValue qScriptValueFromFileDialogProxy(QScriptEngine *engine, const FileDialogProxyPtr &fd)
|
QScriptValue qScriptValueFromFileDialogProxy(QScriptEngine *engine, const FileDialogProxyPtr &fd)
|
||||||
{
|
{
|
||||||
return engine->newQObject(const_cast<FileDialogProxy *>(fd));
|
return engine->newQObject(const_cast<FileDialogProxy *>(fd), QScriptEngine::AutoOwnership,
|
||||||
|
QScriptEngine::PreferExistingWrapperObject | QScriptEngine::ExcludeSuperClassContents);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fileDialogProxyFromQScriptValue(const QScriptValue &scriptValue, FileDialogProxyPtr &fd)
|
void fileDialogProxyFromQScriptValue(const QScriptValue &scriptValue, FileDialogProxyPtr &fd)
|
||||||
@ -158,7 +159,7 @@ QScriptValue FileDialogProxy::fileDialogSave(QScriptContext *context, QScriptEng
|
|||||||
}
|
}
|
||||||
|
|
||||||
FileDialogProxy *fd = new FileDialogProxy(KFileDialog::Saving, parent);
|
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)
|
QScriptValue FileDialogProxy::fileDialogOpen(QScriptContext *context, QScriptEngine *engine)
|
||||||
@ -169,7 +170,7 @@ QScriptValue FileDialogProxy::fileDialogOpen(QScriptContext *context, QScriptEng
|
|||||||
}
|
}
|
||||||
|
|
||||||
FileDialogProxy *fd = new FileDialogProxy(KFileDialog::Opening, parent);
|
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"
|
#include "filedialogproxy.moc"
|
||||||
|
Loading…
Reference in New Issue
Block a user