summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2013-08-29 12:53:18 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-29 17:03:41 +0200
commitb49327145eb984c2051585d89f0826c58d35c116 (patch)
treea1d774dde54deed6659a020021f6cb879fd7eee4 /src/corelib/kernel
parente59a5f9fdcec5df2f54e88d75a75fcb4a2fe577b (diff)
QMetaMethod::invoke: compare the QMetaType id of the return types
Since Qt5, the QMetaObject do not contains the string name of the builtin types, but only the QMetaType id. QMetaMethod::typeName convert back from the id to the string. But if the type is aliased, the string of the main type is returned. This was the case for example for qint64 which is transformed to "qlonglong". This causes a regression in QMetaType::invoke when trying to invoke a method which return an aliased type, since the string comparison would fail. Fix the problem by also comparing the metatype id. Changelog: QMetaMethod::invoke: Fix return of aliased meta type Task-number: QTBUG-33222 Change-Id: Iec7b99dcbf7b23eb818de74f413e4451ce510ac4 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qmetaobject.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 4dc766ecc5..8d6cf5beb5 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -42,6 +42,7 @@
#include "qmetaobject.h"
#include "qmetatype.h"
#include "qobject.h"
+#include "qmetaobject_p.h"
#include <qcoreapplication.h>
#include <qcoreevent.h>
@@ -2098,8 +2099,12 @@ bool QMetaMethod::invoke(QObject *object,
if (qstrcmp(returnValue.name(), retType) != 0) {
// normalize the return value as well
QByteArray normalized = QMetaObject::normalizedType(returnValue.name());
- if (qstrcmp(normalized.constData(), retType) != 0)
- return false;
+ if (qstrcmp(normalized.constData(), retType) != 0) {
+ // String comparison failed, try compare the metatype.
+ int t = returnType();
+ if (t == QMetaType::UnknownType || t != QMetaType::type(normalized))
+ return false;
+ }
}
}