qt5base-lts/tests/auto/corelib
Ivan Solovev b095d26878 QHash/QSet: fix squeeze() for default-constructed container
QHash::squeeze() was unconditionally calling reserve(0), which is
always allocating memory (even for 0 size).
This was leading to a confusing situation when calling squeeze() on
a default-constructed container with 0 capacity() actually allocated
memory. This is very misleading, as squeeze() is supposed to free
unneeded memory, not to allocate more.

This patch adds a check for non-zero capacity. As a result, nothing
is done for default-constructed container.

Note that this patch also affects the QSet::squeeze() behavior, because
QSet uses QHash as its underlying data type.

Task-number: QTBUG-91736
Pick-to: 6.2 6.1
Change-Id: Ib1c3c8b7b3de6ddeefea0e70b1ec71803e8fd3b3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2021-07-27 20:57:49 +02:00
..
animation Avoid use after free in tst_qsequentialanimationgroup 2021-06-02 16:45:23 +02:00
global Fix various -Wdeprecated-enum-float-conversions around the code 2021-07-27 14:58:41 +02:00
io QFileSelector: Preserve path to root directory 2021-07-21 19:37:16 +02:00
itemmodels emit layoutAboutToBeChanged timely 2021-07-20 21:27:27 +01:00
kernel QTranslator: Fix loading of meta catalogs from absolute .qm path 2021-07-15 08:05:35 +02:00
mimetypes Fix BASE argument of qt_add_resources 2021-05-18 16:02:52 +02:00
platform Android: Add runOnMainAndroidThread() under QNativeInterface 2021-05-26 23:24:11 +00:00
plugin Fix BASE argument of qt_add_resources 2021-05-18 16:02:52 +02:00
serialization Prefer QFAIL("Informative message") over QVERIFY(false) 2021-06-14 15:57:16 +02:00
text QString: extend unit tests 2021-07-22 16:08:33 +02:00
thread Don't report results when the results list is empty 2021-07-27 19:57:27 +02:00
time Fix and clean up utterly confused (and confusing) transition tests 2021-06-15 16:58:46 +02:00
tools QHash/QSet: fix squeeze() for default-constructed container 2021-07-27 20:57:49 +02:00
CMakeLists.txt Add tests for QAndroidApplication's sdkVersion and activity 2021-05-13 01:41:36 +03:00