summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-01-26 13:42:05 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-01-27 13:39:34 (GMT)
commitabeeac820a1da1e1d32768904fa70e048a836c3f (patch)
treedd5798b212dda70a0bfda68b17d8c120ed49e94a
parente6f17306949adf10dd2845880c60346674fc1504 (diff)
downloadQt-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
-rw-r--r--src/corelib/kernel/qmetaobject.cpp7
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;
}