qt5base-lts/tests/auto/corelib
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
..
animation Fix deadlock in QPropertyAnimation 2012-03-07 12:48:49 +01:00
codecs Wrap all Latin 1 strings with QString::fromLatin1 or QLatin1Strings 2012-04-27 22:52:01 +02:00
global Merge master into api_changes 2012-03-27 19:22:48 +02:00
io Wrap all Latin 1 strings with QString::fromLatin1 or QLatin1Strings 2012-04-27 22:52:01 +02:00
itemmodels Remove insignification from qabstractitemmodel test on Mac OS X. 2012-04-24 19:36:55 +02:00
json Don't crash when comparing values containing empty arrays/objects 2012-04-11 16:09:06 +02:00
kernel Fix regression in connectNotify(const char *) emission 2012-05-01 20:03:28 +02:00
mimetypes Make comment() work in the C locale too. 2012-03-22 13:29:50 +01:00
plugin Remove insignification from QPluginLoader and QFactoryLoader tests. 2012-04-17 16:28:46 +02:00
statemachine Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
thread Add a remainingTime() method to the public interface of the QTimer class 2012-04-03 15:10:05 +02:00
tools Re-enable casting to and from "ASCII" on tst_qstring.cpp 2012-04-28 01:16:20 +02:00
xml Convert these files to ASCII or UTF-8 2012-04-27 22:52:01 +02:00
corelib.pro Import QMimeType / QMimeDatabase into QtCore. 2012-02-18 22:19:43 +01:00