summaryrefslogtreecommitdiffstats
path: root/src/corelib
Commit message (Collapse)AuthorAgeFilesLines
* QStorageInfo: limit Linux-only code with Q_OS_LINUXPino Toscano2022-01-161-0/+2
| | | | | | | | | This fixes a build problem (use of PATH_MAX) by eliminating a Linux-specific condition that can't happen on HURD anyway. Pick-to: 6.3 Change-Id: I5dcaf104a60b7850b8af3964fc4cd02ab24acd7b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVersionNumber: change int to qsizetype for index and lengthThiago Macieira2022-01-162-30/+34
| | | | | | | | | | | | | | | | | | This class is not exported, so we can change the non-exported methods. None of the exported methods required change; notably, QVersionNumber::Segments::setVector didn't because it's only called with values 1, 2, and 3. [ChangeLog][Potentially source-incompatible changes] Updated the QVersionNumber API to use qsizetype where length and index values were used. This change retains binary compatibility and the vast majority of users will not experience a source compatibility problem. It could occur with ambiguous overloads when passing results from QVersionNumber to other API not using either int or qsizetype. There could also be new warnings from compilers about converting 64-bit types to 32-bit ones. Change-Id: I0e5f6bec596a4a78bd3bfffd16c9984b61c9b55b Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QTextStream: code tidiesGiuseppe D'Angelo2022-01-162-10/+13
| | | | | | | | | | | | Port the internals to qsizetype, and use QStringView instead of QString as a function parameter. The padding() function is changed to take a qsizetype to avoid warnings, but the maximum padding that can be specified is still limited by the range of an int (this is guarded via an assert). Change-Id: I9dd98e5a534990a1758b080900a12dc793528d19 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QAnyStringView: fix code point -> code unit in the docsGiuseppe D'Angelo2022-01-161-1/+1
| | | | | | | | | | The docs are saying that QAnyStringView sizes are measured in terms of code units of the underlying encoding, not code points. Pick-to: 6.3 6.2 Change-Id: Ic72ffd122e45631e8626c9d57ec24ca348918424 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Prevent repeated instantiations of ↵Marc Mutz2022-01-153-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qRegisterNormalizedMetaType<QList<QModelIndex>>() This, finally, shows some expected results: Clang -ftime-trace: $ ClangBuildAnalyzer --analyze qtgui-spec-before.trace | head -n6 Analyzing build trace from 'qtgui-spec-before.trace'... **** Time summary: Compilation (523 times): Parsing (frontend): 665.7 s Codegen & opts (backend): 298.9 s $ ClangBuildAnalyzer --analyze qtgui-spec-after.trace | head -n6 Analyzing build trace from 'qtgui-spec-after.trace'... **** Time summary: Compilation (525 times): Parsing (frontend): 628.3 s Codegen & opts (backend): 301.0 s GCC 11 time (bash builtin): $ time for ((i=0; i < 3; ++i)) do touch ../qt5/qtbase/src/gui/painting/qpolygon.h ; ninja libQt6Gui.so; done [268/268] Creating library symlink qtbase/lib/libQt6Gui.so.6 qtbase/lib/libQt6Gui.so [268/268] Creating library symlink qtbase/lib/libQt6Gui.so.6 qtbase/lib/libQt6Gui.so [268/268] Creating library symlink qtbase/lib/libQt6Gui.so.6 qtbase/lib/libQt6Gui.so real 4m10,918s user 49m10,099s sys 3m11,719s $ git revert --no-commit HEAD $ time for ((i=0; i < 3; ++i)) do touch ../qt5/qtbase/src/gui/painting/qpolygon.h ; ninja libQt6Gui.so; done [268/268] Creating library symlink qtbase/lib/libQt6Gui.so.6 qtbase/lib/libQt6Gui.so [268/268] Creating library symlink qtbase/lib/libQt6Gui.so.6 qtbase/lib/libQt6Gui.so [268/268] Creating library symlink qtbase/lib/libQt6Gui.so.6 qtbase/lib/libQt6Gui.so real 4m18,630s user 51m11,491s sys 3m16,479s The technique in the comment in qmetatype.h doesn't work on Clang - it runs into -Winstantiation-after-specialization. The whole extern template stuff so miserably fails to meet the goals set out in N1448, not only for MSVC and class templates, but, it seems, on all compilers, and for function templates, too, that I'm giving up on it for now. Unfortunately, I'm not really seeing a way to hide this stuff behind a macro, yet. Task-number: QTBUG-97601 Pick-to: 6.3 Change-Id: I500fd04555e0bd76ac021f75582bd8d8cf339378 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFlatMap: don't sort already ordered dataMarc Mutz2022-01-141-1/+1
| | | | | | | Pick-to: 6.3 6.2 Change-Id: Id7ab2fe09c01500ca5bd23751ba29ed1394bb9b6 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix warning on macOS builds, unbreak -developer-buildVolker Hilsheimer2022-01-141-1/+1
| | | | | | | | | | | The mix of signed (qsizetype) and unsigned long when comparing breaks local -Werror,-Wsign-compare builds. Amends d83dbc3db2f305e745cd75a9fd9c97128eaac42f. Change-Id: I7910b7e2dfaaa01d8069ce52e97c0166e6d3fa30 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* convertDoubleTo: invert the condition so we catch NaNs earlyThiago Macieira2022-01-141-1/+1
| | | | | | | This is floating point, so De Morgan doesn't always apply. Change-Id: I89446ea06b5742efb194fffd16bb9e36025cb387 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* convertDoubleTo: move the precision upgrade test upThiago Macieira2022-01-141-4/+13
| | | | | | | | | | Hopefully, the compiler will realize that the suprema calculated below are actually bigger than these limits and make the appropriate dead code eliminations. Change-Id: I89446ea06b5742efb194fffd16bb99f78b26eb0e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Doc: Mark QSP::PublicShare, Templates for 6.4Kai Köhne2022-01-141-2/+2
| | | | | | | | | The commit missed the 6.3 branching / feature freeze. Task-number: QTBUG-86106 Task-number: QTBUG-78092 Change-Id: I1d6b1efe0d482b6fc1ff3cfbbb440856b8cf1856 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add porting instructions for using binary JSONSona Kurazyan2022-01-131-31/+34
| | | | | | | | | | | Also move the instructions for using the Qt5Compat module to a separate section, since they repeat in a few places. Pick-to: 6.3 6.2 Fixes: QTBUG-99771 Change-Id: Ib9a45043bd9aa462a767780c0986ebfb9a7b948d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Properly detect and declare contiguous iteratorsGiuseppe D'Angelo2022-01-132-16/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The recommended way to detect a contiguous iterator isn't to check the iterator_category; it's to use the iterator concepts. Similarly, the recommendation set in place by P2259 (for being backwards-compatible) is to declare a iterator_concept member, not to change iterator_category to a C++20 category, (also) because legacy code may be checking for equality against a specific category, rather than for convertibility. This is erroneous, but such code exists, alas. This is enshrined in C++20's stdlib: for instance, iterator_traits<Foo*> has random_access_category_tag as iterator_category, but contiguous_iterator_tag as its iterator_concept. Hence: 1) in QArrayDataOps use the concept, and not the category, to do the check 2) when declaring iterators, keep the category as random access, and introduce the concept alias (if supported). Pick-to: 6.2 6.3 Change-Id: Ib600da7331d687a15082becaa6be06aefc24bb9c Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Read QThreadPool::objectName thread-safeAllan Sandfeld Jensen2022-01-132-6/+10
| | | | | | | | | | QThreadPool allows method calls from any thread, but QObject does not so copy objectName so we may use it locally under our own lock. Pick-to: 6.3 6.2 Task-number: QTBUG-99775 Change-Id: Ib28910649f5d0f9ce698c7da495069635d608d03 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Allow reading QObject::objectName from other threads againAllan Sandfeld Jensen2022-01-131-0/+4
| | | | | | | | | | | | The new binding system made it impossible to read from non-owning threads, but we have code that did so with external locking. This patch makes it safe again, assuming all reads and writes are locked. This is left intentionally undocumented. Pick-to: 6.3 6.2 Task-number: QTBUG-99775 Change-Id: I845afa5d545ca0ac762ac369181b1497dac52195 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Tidy up macOS collation and add some assertionsEdward Welbourne2022-01-131-7/+9
| | | | | Change-Id: I7af21ce38f2f23498d7c8a7e027bfffb149a43e3 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Fix an assertion failure in massageAdjustedDateTime()Edward Welbourne2022-01-131-4/+4
| | | | | | | | | | | | | | The QDateTimeData &d it's passed is a copy that's about to be modified; before we do so, we haven't detached so its internals have a ref-count of two, contradicting an assertion in the non-const Data::operator->(); so just directly access d.d->m_timezone, since we know that spec == TimeZone implies !isShort(). Added test that triggered the assertion and now doesn't. Fixes: QTBUG-99668 Pick-to: 6.3 6.2 6.2.3 5.15 Change-Id: I07321ad91be5adce524be18e4ab82eee7110dc6a Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Revise the explanation for leaving QTest::qWait() as it isEdward Welbourne2022-01-131-4/+6
| | | | | | | | | | | | | The recently aborted attempt to act on the comment's recommendation revealed a major performance regression, so mention that instead of the now historical compiler problem that used to be our reason for not simply calling qWaitFor(). Change-Id: I81714b556998217a833c21b4208118b7292b7a96 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Michal Klocek <michal.klocek@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QMetaType: Allow conversion of derived gadget types to their base typesUlf Hermann2022-01-131-5/+11
| | | | | | | | A derived gadget has an is-a relationship with its base type. It should be convertible. In fact, canConvert() already tells us it is. Change-Id: I71a5ac9afd78e88adb23b4d0e757f34077f63207 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Doc: Fix snippet to match actual QFileInfo behaviorKai Köhne2022-01-131-1/+1
| | | | | | | | | | The documentation was already updated in abfac029ceaf6c3199694a50, but the snippet still incorrectly suggested QFileInfo::size would report the actual size of an .lnk file on Windows. Pick-to: 5.15 6.2 6.3 Change-Id: I03b96b2efcb713fbc4dd30fc526e1209806bf5cf Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* QStandardPaths_win: Add mapping for DownloadLocationYuhang Zhao2022-01-131-8/+4
| | | | | | | | | Un-special-case for DownloadLocation. I assume the original code is written like that to be compatible with some really old versions of Windows. Change-Id: I643401910bae9a061f2e02c651971b4f2dd46901 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* QStandardPaths: Remove old MinGW workaroundYuhang Zhao2022-01-131-11/+1
| | | | | | | | | | | | | | | | From the comments the workaround is for MinGW older than v7, now our CI has MinGW v9 trunk, it should be safe to drop this. The magic number is replaced by the official function, although it was introduced in Win8, Qt6's minimum supported platform is Win10, so it's also safe to do. As a drive-by, remove two unused includes. Change-Id: I891fe3883f17d4914932784868d7446299d32c65 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QStandardPath: fix typoYuhang Zhao2022-01-131-1/+1
| | | | | | Pick-to: 6.3 6.2 Change-Id: I12837ce614ea91a8a72191092dc8c835f74107cc Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add a few explicit conversions back from intThiago Macieira2022-01-123-4/+4
| | | | | | | | | | Suppresses GCC's -Wconversion, which is not enabled by default. error: conversion from ‘int’ to ‘quint8’ {aka ‘unsigned char’} may change value [-Werror=conversion] Change-Id: I0e5f6bec596a4a78bd3bfffd16c998102bd51f7c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QString::compare: fix comparing a 4GB string to 1 QCharThiago Macieira2022-01-121-1/+1
| | | | | | | | | | If the size() was larger than INT_MAX, the result would be wrong (and UB). Pick-to: 6.2 6.3 Change-Id: I0e5f6bec596a4a78bd3bfffd16c99763e66c2013 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Q*Parser: Replace "data" with "contents" in stringsRobert Löhning2022-01-122-2/+2
| | | | | | | | | ...to be clearer and avoid confusion with "data section". Change-Id: I13319be0e3e12aecf1e0e86c256007dfe6cb98c6 Pick-to: 6.3 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QJsonObject: use the UTF-8 string comparator in sortingThiago Macieira2022-01-122-4/+2
| | | | | | | | | | No change, the two functions are identical for case-sensitive comparison. But this allows us to remove the comment that explained why we were abusing the Latin1 comparator. Change-Id: I0e5f6bec596a4a78bd3bfffd16c98bbcac6c9dc9 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QByteArray: remove left-over Q_NEVER_INLINE after we removed the tablesThiago Macieira2022-01-121-4/+0
| | | | | | | | | | | | | | | | | | The comment made a reference to the case tables that used to exist in qbytearray.cpp prior to commit 9dd8e655cdd26eeaae30645b7fe013d9a696547f ("Limit QByteArray's 8-bit support to ASCII"). Now that the parameter is a function pointer, not a table, inlining is actually beneficial: we definitely don't want the compiler to emit function calls via the function pointer. At least GCC 11 was already doing constant-propagation of the parameter: While it didn't inline the function, it cloned it and propagated the constant in each of the two clones. There were 4 copies of this function: const and non-const, upper and lower. Change-Id: I0e5f6bec596a4a78bd3bfffd16c912a16602e20a Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QVariant: fix incorrect warning about duplicated alias where there isn'tThiago Macieira2022-01-121-0/+1
| | | | | | | | | | | | | | We were always matching a type name to itself because we forgot to advance the iterator after we did match. The issue was introduced in commit 46dc8e453ae1d0c1eb749cfebe686995f3a6cfd0. Fixes: QTBUG-99620 Task-number: QTBUG-96916 Pick-to: 6.3 6.2 Change-Id: Ib42b3adc93bf4d43bd55fffd16c8a5df6306e404 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Jonas Kvinge <jonas@jkvinge.net>
* Doc: Replace "C:\Documents and Settings" pathsKai Köhne2022-01-123-5/+5
| | | | | | | | | | "C:\Documents and Settings" isn't a real path anymore since Windows Vista. Replace it by C:\Users, or - in the snippet for QDesktopServices that is for demoing a path with space - with C:\Program Files. Pick-to: 6.2 6.3 5.15 Change-Id: I1bef97b6482180a6467fffcd1d62d6c168bcb389 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTzTimeZonePrivate: fix UB (data race on m_icu)Marc Mutz2022-01-121-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | The fallback m_icu QIcuTimeZonePrivate is lazily constructed, which means that two threads each with their own copy of a QTimeZone with a shared QTzTimeZonePrivate will race over who gets to set m_icu, e.g. when concurrently calling QTimeZone::displayName(). Fix by protecting m_icu with a mutex. For simplicity, use a static mutex, not a per-instance one (which would delete the QTzTimeZonePrivate copy constructor, which clone() relies on). This is sufficient for 5.15. For Qt 6, going forward, we could make this lock-less, too. [ChangeLog][QtCore][QTimeZone] Fixed a data race on Unix platforms when implicitly-shared copies of QTimeZone objects were used in certain ways (e.g. calling displayName()) from different threads and Qt was configured with ICU support. Pick-to: 6.3 6.2 5.15 Change-Id: I7e57aef3dd44a90289ad86d0578ece1e54920730 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QFlatMap: re-implement insert() via insert_or_assign()Marc Mutz2022-01-121-33/+4
| | | | | | | | Avoids code duplication. Pick-to: 6.3 6.2 Change-Id: Ic69e46108baf97a0dc9215866d6c707136ee40b2 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QFlatMap: add insert_or_assignMarc Mutz2022-01-121-0/+18
| | | | | | | | | | | | | | | | This does exactly what insert() on Qt associative containers does, but allows to express the intent of using the STL-incompatible Qt insert() semantics, in an STL-compatible way, instead of leaving the reader of the code wondering what semantics are expected. This is part of a very-long-term goal of fixing Qt associative container's insert() behavior, in which QFlatMap, being an affected, but private-API type, is used for proof-of-concept purposes. Task-number: QTBUG-99651 Pick-to: 6.3 6.2 Change-Id: I69010285438259918aef659d3235180c1b5be696 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QCache: fix potential crash in trim()Mårten Nordheim2022-01-121-5/+3
| | | | | | | | | | | | | | | | | We use raw pointers to the Nodes in the QHash which is inherently fine, but we are then subject to invalidation when nodes are moved around during deletion. In trim() we don't actually need to iterate the linked-list since the node we are interested in is always chain.prev Pick-to: 6.3 6.2 6.2.3 Fixes: QTBUG-99710 Task-number: QTBUG-99224 Task-number: QTBUG-99240 Change-Id: I9c2ed69b29e3cadca013113a3553deb44d7382fc Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* QOperatingSystemVersion: Make implementation consistent on all platformsYuhang Zhao2022-01-123-22/+13
| | | | | | | | | | | | | Only Windows is using lambda function, change to static member function to be consistent with other platforms. QOperatingSystemVersionBase::current()'s implementation is exactly the same on all platforms, so move it to the common source file instead of implementing it three times on each platform. Change-Id: I4099235b3b041a9a374e21d537649047ee03e62b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Don't access QObject::objectName during QThread startVolker Hilsheimer2022-01-123-6/+16
| | | | | | | | | | | | | This is a data race, as the thread accesses QObject::objectName on the QThread instance while the thread owning the QThread might modify the objectName. Instead, make a copy in the QThreadPrivate that can be accessed safely. Task-number: QTBUG-96718 Pick-to: 6.3 6.2 5.15 Change-Id: I10701551d498993ca5055daf161636bfb648840c Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Add Q_FLAG for QEventLoop::ProcessEventsFlagsTor Arne Vestbø2022-01-121-0/+1
| | | | | | | | | Helps debugging when printing the flags. Pick-to: 6.3 6.2 Change-Id: Icb306bb1efaf9d3c645c2ac86796d95da5afc4a3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFlatMap: add an alias for using QVarLengthArraysMarc Mutz2022-01-121-0/+3
| | | | | | | | | | ... in an attempt to foster the use of this data structure by making it less onerous to spell. Pick-to: 6.3 6.2 Change-Id: Ib9d17029c75278edde6ba90f65f68af179a6d230 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QFlatMap: add try_emplace (w/o hint)Marc Mutz2022-01-121-0/+24
| | | | | | | | | | | | | | | | | | | | | | QFlatMap, like its public brethren, features the broken Qt-style insert() behavior (what the STL calls insert_or_assign()), which makes its insert() unusable for actual STL-style insert() work, with no replacement except the size-check-and-index-operator trick: const auto oldSize = c.size(); auto &e = c[key]; if (c.size() != oldSize) { // inserted } Even though QFlatMap::insert() appears to return the correct info, it's useless, because the old value has been assigned over by the time insert() returns. Pick-to: 6.3 6.2 Change-Id: If4173c42523a128dfd22ab496dde0089ba73f41c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QFlatMap: optimize construction from existing containersMarc Mutz2022-01-121-14/+7
| | | | | | | | | Use {copy,move} ctors instead of default-ctor, followed by (move|copy)-assignment. Pick-to: 6.3 6.2 Change-Id: Id2fd53050cd353a9374fd065ac25d753d42d1be9 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QFlatMap: fix pointless reallocations on repeated range-insert()sMarc Mutz2022-01-121-2/+0
| | | | | | | | | | | | When looping over range-insert(), the repeated shrink_to_fit() calls would cause cause reserved (or geometrically-grown) capacity to be shed, breaking the underlying container's growth strategy. Fix by not shedding excess capacity. Pick-to: 6.3 6.2 Change-Id: I10915a06fc9442039c192486a55e48083da7c839 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QByteArray: fix append() with a negative lengthThiago Macieira2022-01-111-2/+2
| | | | | | | | | | | | The documentation says that if it's negative, we find the null termination. This bug was introduced with the clean up to use QByteArrayView in commit 8897aa071a668563a53a4c2e6909572f1762b1e7. Fixes: QTBUG-99640 Pick-to: 6.3 6.2 Change-Id: Ib42b3adc93bf4d43bd55fffd16c89fa4a960f3a9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Revert "Implement QTest::qWait() in terms of QTest::qWaitFor()"Michal Klocek2022-01-081-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 5c908c826313143a65ef7e95e5af6625fe1ba813. git-bisect points to this commit as the cause for serious test regressions in the qtwebengine module where test time execution goes up 10 times (at least for debug builds), causing timeouts. The reason for the time regression in test execution is caused as the 'processEvents' call is no longer executed with 'remaining' time: QCoreApplication::processEvents(QEventLoop::AllEvents, remaining) 'processEvents' do not spin for the whole duration and instead it calls 'predicate' after all event processing but before proceeding with new events. This introduces significant Chromium's message pump lag and makes test execution much slower. In case of relanding this change we need to go through all tests and extend timeouts, which is not feasible at the moment. This is a quick-fix for 6.3. Change-Id: I90696479bfb9f0a0b8a8acc5bb7e7058b7d0c462 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit f2d0b327e4e6a6c4b72998c290d554d6c4a8f5b6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Replace QString::utf16() with data() in memcpy() and QByteArray ctorØystein Heskestad2022-01-072-4/+4
| | | | | | | | | | | QString::utf16() needlessly detaches fromRawData() to ensure a terminating NUL. Use data() where we don't require said NUL, taking care not to call the mutable data() overload, which would detach, too. Task-number: QTBUG-98763 Change-Id: I7075a8f18ab1f82ebbcf8cfab1643e8ab7f38d51 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QFlatMap: fix const iterator APIMarc Mutz2022-01-071-8/+8
| | | | | | | | Iterators model pointer, so const must be shallow. Pick-to: 6.3 6.2 Change-Id: I90494c98762f1494efcca4965ee739540333f5d7 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QFlatMap: fix mixed rvalue/lvalue insert overloadsMarc Mutz2022-01-071-2/+2
| | | | | | | | They never worked. Pick-to: 6.3 6.2 Change-Id: I9a15c848416419823f28ea580248fbe93a4365dd Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QOperatingSystemVersion_win: Allow override as Windows 11Yuhang Zhao2022-01-071-2/+7
| | | | | | | And added some later Windows Server versions. Change-Id: I81415f1044d11458a4b4d19b01ce90e357f9d111 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTzTimeZonePrivate: use ctor delegation instead of init()Marc Mutz2022-01-052-9/+9
| | | | | | | | | | | | | | This makes it obvious that the code in init() is only called from the constructor and its m_icu handling doesn't need mutex protection (to be added in a subsequent commit). Since the input to the ctor is the result of a virtual function, factor said virtual into a static function and call that instead. Pick-to: 6.3 6.2 5.15 Change-Id: I7c49f2e865201a2ce2b2d86b19dae29c6d337e0e Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTzTimeZonePrivate: fix permanently-detaching m_icuMarc Mutz2022-01-051-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | The m_icu member is a mutable QSharedDataPointer, which means that only the non-const API subset is accessible, and so any access to it will always detach, in 5.15 even a check like if (m_icu), which the code luckily doesn't use (Qt 6 added a operator bool() const). We don't need detaching behavior here, though, since, once set, m_icu is never changed. So just use a QExplicitlySharedDataPointer instead, and never call detach() (which would do the wrong thing). Just in case someone does add a detach() later, instantiate QExplicitlySharedDataPointer over QIcuTimeZonePrivate directly. This requires making displayName() overloads from QTimeZonePrivate visible in QIcuTimeZonePrivate. Add an assertion that QIcuTimeZonePrivate is final, with instructions on what to do if it fails. Finally, hold a pointer-to-const to avoid race conditions in the pointee. The code still contains a data race, due to the lazy initialization of m_icu, but now we have at least a fighting change to fix it. Pick-to: 6.3 6.2 5.15 Change-Id: I32c343822dac43f96d9fbc4c759fa44138861eae Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFutureCallOutInterface: de-inline dtorMarc Mutz2022-01-052-1/+3
| | | | | | | Pick-to: 6.3 Task-number: QTBUG-45582 Change-Id: I5f3411e1dcea4b76fb0e729f612516db3163c93a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QGlobalStatic: invert the order of destruction and setting the guardThiago Macieira2022-01-051-2/+2
| | | | | | | | | | | | | | | | This is how the old implementation did it: the Type member was a member of Holder, but the guard was set to Destroyed in the HolderBase destructor, which ran after. I find the way I implemented in commit81a31beeb25eaf14d5c5f42fe26aa49d6ef29bf8 to be more natural, but it caused regressions at runtime for code that attempted to reenter the global static on destruction. Not unit-tested because I don't know if we want to keep this forever. Pick-to: 6.3 Fixes: QTBUG-99192 Change-Id: Ib42b3adc93bf4d43bd55fffd16c09d7f835d121e Reviewed-by: Marc Mutz <marc.mutz@qt.io>