Make it possible to call QQmlEngine::setObjectOwnership at any time
authorSimon Hausmann <simon.hausmann@digia.com>
Fri, 28 Feb 2014 15:19:10 +0000 (16:19 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Sun, 2 Mar 2014 21:29:57 +0000 (22:29 +0100)
commit76e0a3b4da22fab6c5fb94e12f3a94fba83fd042
tree68effedde10f8bf5ce1f0dd7615008008c6e836b
parentac57f185d1a2203cd4b585df7bd7af01c3ec33ed
Make it possible to call QQmlEngine::setObjectOwnership at any time

QJSEngine::newQObject should call setObjectOwnership only if it wasn't
called before, to preserve any policy set by the user earlier. Otherwise
it's only safe to call after newQObject and then you'd have to call it
_every_ time the QObject is wrapped, at all call sites. Instead this
patch preserves any policy set.

Task-number: QTBUG-37160

Change-Id: I6178fa38cd7f4b09d818b6f18762c21588562422
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/jsapi/qjsengine.cpp
tests/auto/qml/qjsengine/tst_qjsengine.cpp