qt5base-lts/tests/auto/corelib/kernel
Kent Hansen 74c3517e6a Fix regression in connectNotify(const char *) emission
Reimplementations of connectNotify() and disconnectNotify() can
assume that the signal argument is in normalized form, but after the
introduction of the Qt5 meta-object format, it could happen that it's
not.

The problem is that the internal QArgumentType class, which attempts
to resolve a typename to a type id, was calling QMetaType::type().
QMetaType::type() falls back to trying the normalized form of the
typename if the original argument can't be resolved as a type (this
behavior isn't documented, but that's how it works). This means that
e.g. QMetaType::type("const QString &") returns QMetaType::QString.

Since QMetaObjectPrivate::indexOfMethodRelative() (more specifically,
the methodMatch() helper function) prefers to compare type ids
over typenames (since the type ids are stored directly in the meta-
object data for built-in types), the method lookup would *succeed*
for signatures with non-normalized built-in typenames as parameters.
QObject::connect() would then think that it did not have to
normalize the signature (see "// check for normalized signatures").
The consequence was that the original, non-normalized form got
passed to connectNotify().

This commit introduces an internal typename-to-type function that
is the same as QMetaType::type(), except it doesn't try to normalize
the name. This way, the only place where normalization can occur in
the signature-to-meta-method processing is through the calls to
QMetaObject::normalizedSignature() in QObject::connect() itself.

The implication is that there are now cases where the method
signature will be decoded and processed twice, where processing it
once was sufficient before. On the other hand, it is consistent with
the pre-Qt5-meta-object behavior, where we predict that the
signature is already normalized, and only perform (comparatively
costly) normalization if the initial lookup fails.

Change-Id: Ie6b60f60b0f9a57ebd378d980329dac62d57bbd9
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-05-01 20:03:28 +02:00
..
qcoreapplication Merge remote-tracking branch 'origin/master' into api_changes 2012-04-10 15:31:45 +02:00
qeventdispatcher Test posted events in tst_QEventDispatcher with various flags 2012-02-10 15:22:11 +01:00
qeventloop QEvent (and subclasses): make ctors explicit 2012-03-01 08:44:34 +01:00
qmath Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
qmetamethod Add QMetaMethod::fromSignal() function 2012-04-27 10:37:02 +02:00
qmetaobject Fix QMetaObject::normalizedType() for "void" argument 2012-03-21 18:55:27 +01:00
qmetaobjectbuilder Fixed uninitialized memory in QMetaObjectBuilder::fromRelocatableData 2012-05-01 09:41:27 +02:00
qmetaproperty Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
qmetatype Merge remote-tracking branch 'origin/master' into api_changes 2012-04-10 15:31:45 +02:00
qmimedata QMimeData: export URLs as text too 2012-02-17 05:26:47 +01:00
qobject Fix regression in connectNotify(const char *) emission 2012-05-01 20:03:28 +02:00
qpointer Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
qsignalmapper Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
qsocketnotifier Fix tst_QSocketNotifier on Mac OS X 2012-02-13 22:16:17 +01:00
qtimer Merge "Merge remote-tracking branch 'origin/api_changes'" into refs/staging/master 2012-04-17 13:09:29 +02:00
qtranslator Make QTranslator testcase independent of Widgets 2012-03-28 00:44:16 +02:00
qvariant Wrap all Latin 1 strings with QString::fromLatin1 or QLatin1Strings 2012-04-27 22:52:01 +02:00
qwineventnotifier Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
kernel.pro Add autotest for QMetaMethod introspection 2012-02-15 17:27:04 +01:00