diff options
author | Charles Yin <charles.yin@nokia.com> | 2012-05-03 09:55:48 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-03 03:56:02 +0200 |
commit | ccd69247eaa6289bc31115f863ba4737b14fe34e (patch) | |
tree | c9a4d7c2b6a2adab762319e3e1c71bfc06e5690b /src | |
parent | 9b789fd4e516577fa5dbffdf5dbfb4d7f99e985b (diff) |
Add a static flag to avoid unnecessary QQmlData::init() calls
Change-Id: I0b38753bfaf2d1e22ab67977001b946a686b0f56
Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/qml/qqmldata_p.h | 15 | ||||
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 10 |
2 files changed, 11 insertions, 14 deletions
diff --git a/src/qml/qml/qqmldata_p.h b/src/qml/qml/qqmldata_p.h index 0686830dcd..e97bbb15dc 100644 --- a/src/qml/qml/qqmldata_p.h +++ b/src/qml/qml/qqmldata_p.h @@ -83,14 +83,19 @@ public: bindings(0), signalHandlers(0), nextContextObject(0), prevContextObject(0), bindingBitsSize(0), bindingBits(0), lineNumber(0), columnNumber(0), deferredComponent(0), deferredIdx(0), v8objectid(0), propertyCache(0), guards(0), extendedData(0) { + init(); } static inline void init() { - QAbstractDeclarativeData::destroyed = destroyed; - QAbstractDeclarativeData::parentChanged = parentChanged; - QAbstractDeclarativeData::objectNameChanged = objectNameChanged; - QAbstractDeclarativeData::signalEmitted = signalEmitted; - QAbstractDeclarativeData::receivers = receivers; + static bool initialized = false; + if (!initialized) { + initialized = true; + QAbstractDeclarativeData::destroyed = destroyed; + QAbstractDeclarativeData::parentChanged = parentChanged; + QAbstractDeclarativeData::objectNameChanged = objectNameChanged; + QAbstractDeclarativeData::signalEmitted = signalEmitted; + QAbstractDeclarativeData::receivers = receivers; + } } static void destroyed(QAbstractDeclarativeData *, QObject *); diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 5ae35f959c..7cb766b17c 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -468,15 +468,6 @@ int QQmlData::endpointCount(int index) return count; } -namespace { - class QQmlDataInitializer { - public: - QQmlDataInitializer() { - QQmlData::init(); - } - } _initializer; -} - void QQmlEnginePrivate::init() { Q_Q(QQmlEngine); @@ -485,6 +476,7 @@ void QQmlEnginePrivate::init() if (firstTime) { qmlRegisterType<QQmlComponent>("QML", 1, 0, "Component"); + QQmlData::init(); firstTime = false; } |