diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-01-26 13:42:05 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-01-27 13:39:34 (GMT) |
commit | abeeac820a1da1e1d32768904fa70e048a836c3f (patch) | |
tree | dd5798b212dda70a0bfda68b17d8c120ed49e94a /src/corelib/kernel/qmetaobject.cpp | |
parent | e6f17306949adf10dd2845880c60346674fc1504 (diff) | |
download | Qt-abeeac820a1da1e1d32768904fa70e048a836c3f.zip Qt-abeeac820a1da1e1d32768904fa70e048a836c3f.tar.gz Qt-abeeac820a1da1e1d32768904fa70e048a836c3f.tar.bz2 |
Make indexOfMethod not crash when going through a metaobject with methodCount == 0.
Reviewed-by: Bradley T. Hughes
Diffstat (limited to 'src/corelib/kernel/qmetaobject.cpp')
-rw-r--r-- | src/corelib/kernel/qmetaobject.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index d391893..be1b2ae 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -492,10 +492,14 @@ static inline int indexOfMethodRelative(const QMetaObject **baseObject, const char *method, bool normalizeStringData) { - while (*baseObject) { + const QMetaObject *m; + for (m = *baseObject; m; m = *baseObject = m->d.superdata) { const QMetaObject *const m = *baseObject; int i = (MethodType == MethodSignal && priv(m->d.data)->revision >= 4) ? (priv(m->d.data)->signalCount - 1) : (priv(m->d.data)->methodCount - 1); + if (i < 0) + continue; + const int end = (MethodType == MethodSlot && priv(m->d.data)->revision >= 4) ? (priv(m->d.data)->signalCount) : 0; if (!normalizeStringData) { @@ -513,7 +517,6 @@ static inline int indexOfMethodRelative(const QMetaObject **baseObject, return i; } } - *baseObject = m->d.superdata; } return -1; } |