From 4af3a3abdef768ff067fa23e6dece058d7a6b9e1 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Wed, 1 Feb 2012 17:42:00 +1000 Subject: Fix qdeclarativeecmascript test failure. Don't use hardcoded constants for the number of methods belonging to QObject as they can and have changed. Change-Id: Iaae3bb6cad34fce6c2351217480755f1ac2f6085 Reviewed-by: Matthew Vogt --- src/declarative/qml/qdeclarativepropertycache.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/declarative') diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp index 6b08f1b0..be8f3519 100644 --- a/src/declarative/qml/qdeclarativepropertycache.cpp +++ b/src/declarative/qml/qdeclarativepropertycache.cpp @@ -190,7 +190,9 @@ QDeclarativePropertyCache::Data QDeclarativePropertyCache::create(const QMetaObj } int methodCount = metaObject->methodCount(); - for (int ii = methodCount - 1; ii >= 3; --ii) { // >=3 to block the destroyed signal and deleteLater() slot + // >=QObject::staticMetaObject.methodCount() to block the destroyed signal and deleteLater() slot + // and other QObject methods. + for (int ii = methodCount - 1; ii >= QObject::staticMetaObject.methodCount(); --ii) { QMetaMethod m = metaObject->method(ii); if (m.access() == QMetaMethod::Private) continue; @@ -248,8 +250,8 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine); int methodCount = metaObject->methodCount(); - // 3 to block the destroyed signal and the deleteLater() slot - int methodOffset = qMax(3, metaObject->methodOffset()); + // QObject::staticMetaObject.methodCount() to block the destroyed signal and the deleteLater() slot + int methodOffset = qMax(QObject::staticMetaObject.methodCount(), metaObject->methodOffset()); methodIndexCache.resize(methodCount); for (int ii = methodOffset; ii < methodCount; ++ii) { -- cgit v1.2.3