diff options
author | Chris Adams <christopher.adams@nokia.com> | 2011-12-20 15:33:47 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-20 07:34:58 +0100 |
commit | 97f6dbcd27fa0a2f72d3a58b0bd9aea1b930e464 (patch) | |
tree | 1c4d066b595e318b646d5974a46e69f53cbac29e /src/declarative | |
parent | b26bda8654e9ac4c8ede56adba9d597f24f1ecac (diff) |
Remove hardcoded assumptions about methods in QObject
This commit ensures that the number of methods available from the
QObject::staticMetaObject is looked up rather than hardcoded to
a value in the QDeclarativePropertyCache.
Task-number: QTBUG-22985
Change-Id: If61c02f0d32066cddaeac2d8143c58db97acb609
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/qml/qdeclarativepropertycache.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp index 67d0cea086..bd3bc338ce 100644 --- a/src/declarative/qml/qdeclarativepropertycache.cpp +++ b/src/declarative/qml/qdeclarativepropertycache.cpp @@ -357,8 +357,9 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb } } - // 3 to block the destroyed signal and the deleteLater() slot - int methodOffset = qMax(3, metaObject->methodOffset()); + // qMax(defaultMethods, methodOffset) to block the signals and slots of QObject::staticMetaObject + // incl. destroyed signals, objectNameChanged signal, deleteLater slot, _q_reregisterTimers slot. + int methodOffset = qMax(QObject::staticMetaObject.methodCount(), metaObject->methodOffset()); int signalOffset = signalCount - QMetaObjectPrivate::get(metaObject)->signalCount; // update() should have reserved enough space in the vector that this doesn't cause a realloc @@ -757,8 +758,10 @@ QDeclarativePropertyData qDeclarativePropertyCacheCreate(const QMetaObject *meta } int methodCount = metaObject->methodCount(); - for (int ii = methodCount - 1; ii >= 3; --ii) { - // >=3 to block the destroyed signal and deleteLater() slot + int defaultMethods = QObject::staticMetaObject.methodCount(); + for (int ii = methodCount - 1; ii >= defaultMethods; --ii) { + // >=defaultMethods to block the signals and slots of QObject::staticMetaObject + // incl. destroyed signals, objectNameChanged signal, deleteLater slot, _q_reregisterTimers slot. QMetaMethod m = metaObject->method(ii); if (m.access() == QMetaMethod::Private) continue; |