qt5base-lts/tests/auto
Carl Schumann a70b8d407e Fix bug when destruction fields in QWizard
Maintain the consistency of QWizardPrivate's two members:
    QVector<QWizardField> fields;
    QMap<QString, int> fieldIndexMap;
during and after calls to QWizardPrivate's
void _q_handleFieldObjectDestroyed(QObject *)
member function.  The failure to maintain this consistency
caused an out of bounds access and core dump in
QWizard's field(const QString &name) member function.

QWizard's field(const QString &name) member function expects
the values in the QMap fieldIndexMap to be indexes into the
QVector fields.  Prior to this change
_q_handleFieldObjectDestroyed only removed the appropriate
entry from the map and erased it from the vector.  It did
not decrement by one all the indexes greater than the index
that was removed from the map and erased from the vector
in the rest of the map.

For example ...
So if initially have the following mapping ...
"field0" -> 0,
"field1" -> 1, and
"field2" -> 2
with fields of size 3. After destruction of "field1" have ...
"field0" -> 0, and
"field2" -> 2
with fields of size 2.
Now attempts to look up "field2" using QWizard::field will
have an out of bounds error and possibly core dump or trigger
an internal Qt assert because an attempt to access
this->fields[2] will be made.   It should be accessing
this->fields[1], but does not because the map is no longer
consistent with the vector.

This change adds a decrement by one for all the indexes
greater than the index that was removed from the map and
erased from the vector.

Task-number: QTBUG-25691
Change-Id: Ia2a41027628a65faec4ecdd5da235ddd19746a57
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-05-16 22:03:30 +02:00
..
cmake Use IF(NOT TARGET ...) before creating imported targets. 2012-05-15 23:03:23 +02:00
compilerwarnings/data Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
concurrent Remove insignification from QtConcurrentFilter test. 2012-04-19 13:26:51 +02:00
corelib Limit the nesting depth of the Json parser 2012-05-16 04:25:11 +02:00
dbus Fix unit confusion in ccf3b9e48b2d773999a9a88e249f79380618cde6 2012-05-02 22:49:26 +02:00
gui enable the text layout's cache where it is seems to be missed 2012-05-16 19:38:01 +02:00
guiapplauncher Update the documentation after moving examples. 2011-07-05 21:19:08 +02:00
network tst_QNetworkReply: enable the ioGetFromBuiltinHttp test. 2012-05-16 04:24:38 +02:00
opengl Expose QPA API under qpa/* 2012-05-07 20:25:24 +02:00
other enable the text layout's cache where it is seems to be missed 2012-05-16 19:38:01 +02:00
printsupport Revert "QtPrintSupport: Remove remaining LPR specific code" 2012-05-08 06:58:27 +02:00
shared Expose QPA API under qpa/* 2012-05-07 20:25:24 +02:00
sql Fix encoding mismatches in tst_QSqlQuery 2012-05-07 05:03:17 +02:00
testlib Make the event notification on Windows be mandatory in all dispatchers 2012-05-04 12:44:14 +02:00
tools Change remaining uses of {to,from}Ascii to {to,from}Latin1 [QtDBus] 2012-05-07 05:05:30 +02:00
widgets Fix bug when destruction fields in QWizard 2012-05-16 22:03:30 +02:00
xml Change remaining uses of {to,from}Ascii to {to,from}Latin1 [QtXml] 2012-05-03 11:33:05 +02:00
auto.pro Re-enable network tests on Mac OS. 2012-04-24 16:06:28 +02:00
network-settings.h Don't require exact IMAP server version in autotests 2012-04-03 12:45:46 +02:00
platformquirks.h Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
test.pl Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00