summaryrefslogtreecommitdiffstats
path: root/src/corelib
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.13.2' into 5.13Qt Forward Merge Bot2019-10-301-1/+1
|\ | | | | | | Change-Id: Ieb5afc87086758119bcfc8efbe355f5c0a93fc04
| * Merge 5.13 into 5.13.2Frederik Gladhorn2019-10-113-2/+9
| |\ | | | | | | | | | Change-Id: Id8852e90bfc5e4bd3e344435195992c5c7a0ab86
| * | Fix build: disable the HWRNG in bootstrapped modeThiago Macieira2019-10-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qmake build fails: qrandom.o: in function `QRandomGenerator::SystemGenerator::generate(unsigned int*, unsigned int*)': /home/tjmaciei/src/qt/qt5/qtbase/src/corelib/global/qrandom.cpp:333: undefined reference to `qRandomCpu(void*, long long)' Fixes: QTBUG-78937 Change-Id: Ib5d667bf77a740c28d2efffd15cb4236f765917c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Fix a -Wclass-memaccess problem in qjsonVille Voutilainen2019-10-241-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | qtbase/src/corelib/serialization/qjson_p.h:230:38: error: ‘void* memcpy(void*, const void*, size_t)’ copying an object of type ‘QJsonPrivate::qle_ushort’ {aka ‘class QSpecialInteger<QLittleEndianStorageType<short unsigned int> >’} with ‘private’ member ‘QSpecialInteger<QLittleEndianStorageType<short unsigned int> >::val’ from an array of ‘const class QChar’; use assignment or copy-initialization instead [-Werror=class-memaccess] 230 | str.length()*sizeof(ushort)); | ^ Change-Id: Ie58e7fe4bae3003227364012ad56ab23bd560d8c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QEndian: do not use "raw" constexprGiuseppe D'Angelo2019-10-141-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the Qt's macros instead, since constexpr support may be revoked on certain compilers. Amends d26289ffb43a5fcf34e855db1dfbf42aa03c4f5a. Change-Id: I62354b14b57ae5fcbf3f1186ddb48bcf26535e90 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Use arrays rather than assigning literals to char* (warning-fix)Edward Welbourne2019-10-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Integrity has a hack, to let us link to the library mmap is in, that depends on two extern "C" symbols of type char *; but assigning a string literal to a char * variable as initializer is a const-ness violation (as the Integrity compiler does point out), so change the two variables to be char[] instead of char *, so that the literals populate (and determine the size of) the arrays, instead. Change-Id: Iab34fb378bc0522e14539592ead066f068751ad0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | QStandardPaths: Correct handling for XDG_RUNTIME_DIRSamuli Piippo2019-10-121-23/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Always try to create the runtime directory and never change the permissions of an existing directory. Conform to the XDG Base Directory Specification: "If, when attempting to write a file, the destination directory is non-existent an attempt should be made to create it with permission 0700. If the destination directory exists already the permissions should not be changed." Fixes: QTBUG-68338 Change-Id: Iaf854d69225fc46e43abae86232d749e5c247df0 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Q{Shared,Weak}Pointer: Reduce overload sets in implicit conversionsMilian Wolff2019-10-111-31/+20
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only allow implicit conversions when the types involved are compatible. That means, only allow construction and copy assignment when the type X* is convertible to type T*. This is done using SFINAE and the std::is_convertible type trait, which makes the previous QSHAREDPOINTER_VERIFY_AUTO_CAST obsolete. This patch fixes compilation when a function is overloaded with Q{Shared,Weak}Pointer of different, incompatible types. Previously, this resulted in a compilation error due to an ambiguous overload. Change-Id: I069d22f3582e69842f14284d4f27827326597ca2 Fixes: QTBUG-75222 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Include XDG font locations in QStandardPaths::FontsLocation on LinuxAlex Henrie2019-10-082-1/+4
| | | | | | | | | | | | | | | | | | | | ~/.fonts was deprecated in 2012, see https://wiki.archlinux.org/index.php/Font_configuration#Fontconfig_configuration Few people keep fonts there anymore. Change-Id: Ide048e1df2c2db4856a38c574df36663ab684f89 Reviewed-by: David Faure <david.faure@kdab.com>
* | Fix crash when running QtCore: Stack is misaligned on x86-64Thiago Macieira2019-10-031-1/+5
|/ | | | | | | | | | When our ELF entry point function is started by the kernel, the stack is aligned at 16 bytes. However, the stack is expected to be off by 8, due to a preceding CALL instruction which didn't exist. This cauases a crash further down as the compiler may generate aligned stack access. Change-Id: I1496b069cc534f1a838dfffd15c9dc4ef9e3869e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QList: make cast from ptrdiff_t to int explicitEdward Welbourne2019-10-021-1/+1
| | | | | | | | Amends ffc2d5722317fcab86865b11491d7bf7fef3e16d. Fixes: QTBUG-78235 Change-Id: Ie91d8d71c92bb62e3268847407b7b252c382d700 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QVarLengthArray: Avoid int vs. size_t warnings in operator=Laszlo Agocs2019-09-291-1/+1
| | | | | Change-Id: I879b62c55e4211d3e4e1a18f6699f26e3f5de1f8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Windows/MinGW: Fix posted events timer not stoppingFriedemann Kleint2019-09-272-3/+7
| | | | | | | | | | Specify the type of the enum value SendPostedEventsWindowsTimerId to be UINT_PTR to work with the g++ interpretation of enumeration signedness and use the correct type for the returned timer id. Fixes: QTBUG-78491 Change-Id: I7b3f306d3f60da7a21500ece5243ac90854ccf1a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix QRandomGenerator initialization on AMD CPUsDmitry Kazakov2019-09-264-51/+88
| | | | | | | | | | | | | | Some AMD CPUs (e.g. AMD A4-6250J and AMD Ryzen 3000-series) have a failing random generation instruction, which always returns 0xffffffff, even when generation was "successful". This code checks if hardware random generator generates four consecutive equal numbers. If it does, then we probably have a failing one and should disable it completely. Change-Id: I38c87920ca2e8cce4143afbff5e453ce3845d11a Fixes: QTBUG-69423 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QFileInfo: clarify documentation about handling of symlink attributesThiago Macieira2019-09-251-11/+75
| | | | | | | | | | On Windows, shortcut ".lnk" files are treated as symlinks, and attribute queries on a shortcut file return the results for the shortcut target. Fixes: QTBUG-77523 Change-Id: I907a43cd9a714da288a2fffd15bada7eba37d3ba Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Q_FLAG should be applied to the enum, not the QFlagsThiago Macieira2019-09-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | moc extracts he name that is inthe Q_FLAG macro and that gets used in qDebug(). As the documentation described, qDebug would have printed: QFlags<LoadHints>(QLibrary::ResolveAllSymbolsHint) which doesn't compile (though we could have partially specialized QFlags<QFlags<E>> to be QFlags<E>). The semantically correct output is: QFlags<LoadHint>(QLibrary::ResolveAllSymbolsHint) which is what this change gets. The ideal output would be: LoadHints(QLibrary::ResolveAllSymbolsHint) But that's not a doc change. Fixes: QTBUG-77216 Change-Id: I0635172f4f2a4c51a435fffd15b59a859886e90c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Filesystem: avoid crashes on exit in case the locale codec is nullThiago Macieira2019-09-241-1/+3
| | | | | | | | | | | | | | | | | | | On exit, QLocale::codecForLocale() can return null as the codec may have already been destroyed. In that case, pretend that Latin1 was the locale, so any file name is acceptable. This matches QString: QTextCodec *codec = QTextCodec::codecForLocale(); if (codec) return codec->toUnicode(str, size); #endif // textcodec return fromLatin1(str, size); Note that if we're wrong and the locale was *not* Latin1, files that you had a name to may not be encoded or decoded the same way. Fixes: QTBUG-78446 Change-Id: Iece6e011237e4ab284ecfffd15c54077728a17ca Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Remove broken example snippet from Q_ENUMSPaul Wicking2019-09-201-8/+4
| | | | | | | | | | | The code snippet is used by both Q_ENUMS and Q_ENUM. Therefore, remove the example snippet from Q_ENUMS documentation, as it is obsolete. Also, move recommendation to use Q_ENUM in new code to the very top of Q_ENUMS' documentation. Fixes: QTBUG-63203 Change-Id: I12a9f45e0b3bd75dfe98e1ecbc45e299a688b80c Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QRandom: retry the use of RDRAND instruction as recommended by manualsThiago Macieira2019-09-081-7/+12
| | | | | | | | | | | The Intel whitepaper[1] recommends retrying RDRAND some 10 times even after it fails, since the hardware has a fairness algorithm and reseeds itself quite quickly. [1] https://software.intel.com/en-us/articles/intel-digital-random-number-generator-drng-software-implementation-guide Change-Id: I907a43cd9a714da288a2fffd15baafd88242d8b6 Reviewed-by: André Hartmann <aha_1980@gmx.de>
* Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-09-081-2/+2
|\ | | | | | | Change-Id: I371c5ae1af6f58e32e579671f485b92b586e0b76
| * qFatal: make it so you cannot disable the messageThiago Macieira2019-09-041-2/+2
| | | | | | | | | | | | | | | | | | | | Solves a few recursion problems in Qt, since then we won't try to inspect the logging registry while creating the logging registry. Fixes: QTBUG-78007 Change-Id: I44cc9ee732f54d2380bafffd15c0f51c7140682e Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.13.1' into 5.13Qt Forward Merge Bot2019-09-051-1/+1
|\ \ | | | | | | | | | Change-Id: Ic633850940bbe17dcedc1609217a052b6f81ce4b
| * | Revert "Disable debug plugin check for MinGW"Oliver Wolff2019-08-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch caused an error when loading applications built in debug mode with MinGW and thus has to be reverted. This reverts commit bba44746f9f2cfca785a309deb056033ae0bea6e. Fixes: QTBUG-77431 Change-Id: I3134878a742b304d10176cc8b0ed5ce06d4de53f Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* | | QRegexp: Fix MSVC2019 warning about fallthrough not being followed by a case ↵Friedemann Kleint2019-09-031-15/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | label Move fallthrough down, fixing: tools\qregexp.cpp(3014): warning C4468: 'fallthrough': attribute must be followed by a case label or a default label tools\qregexp.cpp(3054): warning C4468: 'fallthrough': attribute must be followed by a case label or a default label tools\qregexp.cpp(3100): warning C4468: 'fallthrough': attribute must be followed by a case label or a default label Change-Id: If25ddec5dc1d4929a3383729aabad89f5879e316 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* | | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-08-312-2/+2
|\ \ \ | | |/ | |/| | | | Change-Id: I9823da32168e99bbece2f8337d0bd4d33e6d634c
| * | Doc: Clarify QJsonDocument::toJson()Joerg Bornemann2019-08-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Mention that this method returns an indented document. Change-Id: I0cadcc1c894c9a87910cfce389c6a5288238044d Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
| * | Remove hardcoded qt_instdate field from binaryFredrik Orderud2019-08-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move hardcoded date to the only client code in the repo. This field is currently modified by MaintenanceTool and possibly windeployqt, which contributes to breaking the DLL signature on Windows. Removing the field should avoid this problem. Task-number: QTBUG-76985 Change-Id: I01386136ac493ea50c99c05879a3e215f3f6344c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge "Merge remote-tracking branch 'origin/5.12' into 5.13"Allan Sandfeld Jensen2019-08-271-2/+2
|\ \ \
| * | | Merge remote-tracking branch 'origin/5.12' into 5.13Allan Sandfeld Jensen2019-08-271-2/+2
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/painting/qdrawhelper.cpp src/gui/painting/qdrawhelper_p.h src/gui/painting/qdrawhelper_sse2.cpp src/gui/painting/qdrawhelper_x86_p.h Change-Id: I83256bb38ab3a705776e353bc0629315b6c59a0f
| | * | Fix assertion on passing nullptr QLatin1Strings to qt_compare_stringsMarc Mutz2019-08-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qstrnicmp() has an assertion that the lhs string is not nullptr. Fix by moving the length check back to the front, regardless of cs's value. Amends cad7100fda1b27ba56c4d9efc6bceba62859dfbc. Change-Id: I31f808936c8dc6fbb10a70a59923746ef3e675e9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | | Docs: Some cleanup of class documentationKavindra Palaraja2019-08-271-140/+127
|/ / / | | | | | | | | | | | | Change-Id: I62f89157e57189a97151f9661bc354af9bd67468 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* | | Also fall back to direct write for Android content: URLs in QSaveFileVolker Krause2019-08-241-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | We cannot rename into content: URLs, so that is the only option, and this is particularly relevant here as the native file dialog will give us content: URLs by default for saving to. Change-Id: Ie96fcfc404a0842d397c7d1554e3c76f06bb3074 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-08-222-1/+10
|\| | | | | | | | | | | Change-Id: Ia4bcd81eff948e56a5eda9519cdbee59b7da54d9
| * | Point out that dynamically modified meta objects are not threadsafeVolker Hilsheimer2019-08-211-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given that this is an exception, it doesn't invalidate the general thread-safety of static meta objects, and putting a locking mechanism into Qt for this would be complete over- (and performance-)kill. Task-number: QTBUG-70915 Change-Id: I4a538b977f5c2e8173cb236023e5d9ca34add5b5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * | Fix qErrnoWarning() printing no error in some conditionsThiago Macieira2019-08-191-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because it allocates memory, it may call system functions that set errno or Win32's GetLastError(). [ChangeLog][QtCore] Fixed a bug that made qErrnoWarning() say there was no error when generating the error message. Fixes: QTBUG-77322 Change-Id: Ife213d861bb14c1787e1fffd15b811a4f83cf3e7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | | Merge "Merge remote-tracking branch 'qt/5.12' into 5.13"Paul Olav Tvete2019-08-201-1/+1
|\ \ \
| * | | Merge remote-tracking branch 'qt/5.12' into 5.13Paul Olav Tvete2019-08-201-1/+1
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/configure.json src/gui/util/qtexturefilereader.cpp src/gui/util/util.pri tests/auto/gui/util/qtexturefilereader/tst_qtexturefilereader.cpp Change-Id: I2bc4f84705b66099e97330cda68e0b816aceb9cc
| | * | Fix typo in description of feature datestringEdward Welbourne2019-08-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I858512af94b5160a0008789ca972cd57307cc9e2 Reviewed-by: Tasuku Suzuki <tasuku.suzuki@qbc.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | | | Fix building with -no-feature-codecsAllan Sandfeld Jensen2019-08-201-2/+5
|/ / / | | | | | | | | | | | | Change-Id: Ifce31a5ef07101f5ef8aabbc81b42eee47153961 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-08-152-9/+15
|\| | | | | | | | | | | Change-Id: Id7954ada1f8658d3b1da5e8241a09f2d201a7c56
| * | QSysInfo: Use the Apple IOKit API to get the machine's UUIDThiago Macieira2019-08-141-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | Turns out that kern.uuid is not as unique as we thought. Googling for mine finds other instances of the same being used. Fixes: QTBUG-75371 Change-Id: I95ecabe2f50e450c991afffd159850cc975ec0da Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
| * | Add the detection of MSVC 2019 for QLibraryInfoFriedemann Kleint2019-08-141-1/+3
| | | | | | | | | | | | | | | Change-Id: Ie3ea1cdae60bf0d7dd89a0ab84146c8370559a29 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* | | Merge remote-tracking branch 'origin/5.12' into 5.13Liang Qi2019-08-123-11/+13
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config.tests/arch/write_info.pri Repair architecture config test for the WASM_OBJECT_FILES=1 build mode configure.pri tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp Done-With: Jörg Bornemann <joerg.bornemann@qt.io> Change-Id: I9e12088356eb5bc65b53211cd7a8e330cccd1bb4
| * | Fix integer overflow in QCryptographicHash's SHA-3 supportThiago Macieira2019-08-101-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because 256 MB * 8 = 2 Gbit, but length*8 is a signed integer overflow, hence UB. Can't really autotest this. Not all systems where we're going to test can allocate 256 MB of RAM. [ChangeLog][QtCore][QCryptographicHash] Fixed a bug that caused the SHA-3 and Keccak algorithms to crash if passed 256 MB of data or more. Fixes: QTBUG-77362 Change-Id: Iec9c051acd73484c8d94fffd15b91f4b1450f5d7 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| * | Fix sign change warningSimon Hausmann2019-08-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | The conversion from int to uint is deliberate here, so let's cast and avoid a warning for users compiling with warnings enabled. Change-Id: I7136d6161ace735be49f8d987338f6d401a5c78a Fixes: QTBUG-77245 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | QBitArray: fix fromBits() and actually test itThiago Macieira2019-08-081-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When I initially added it, it was ony for QCborValue, but I never added the tests. Turns out there were two bugs: [ChangeLog][QtCore][QBitArray] Fixed two bugs that caused QBitArrays created using fromBits() not to compare equal to the equivalent QBitArray created using other methods if the size was zero or not a multiple of 4. If the size modulus 8 was 5, 6, or 7, the data was actually incorrect. Fixes: QTBUG-77285 Change-Id: Ife213d861bb14c1787e1fffd15b70573d162042c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | QList: fix some integer cast warnings from 64- to 32-bitThiago Macieira2019-08-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Not tested because we're not promising to fix them all. Just those two that were reported. Fixes: QTBUG-77391 Change-Id: Iec9c051acd73484c8d94fffd15b91f5e6348635d Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | QBitArray: change modulo 8 with bitwise-AND 7Thiago Macieira2019-08-081-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They're the same only for unsigned values. Modulo of negative numbers since C++11 has an expected behavior and generates more code: %rax = %rax & 7: andl $7, %eax %rax = %rax % 8 with GCC: cqto shrq $61, %rdx addq %rdx, %rax andl $7, %eax subq %rdx, %rax [read as ((%rax + (%rax < 0 ? 7 : 0)) & 7) - (%rax < 0 ? 7 : 0))] With Clang: movq %rax, %rcx sarq $63, %rcx shrq $61, %rcx addq %rax, %rcx andq $-8, %rcx subq %rcx, %rax Change-Id: Ife213d861bb14c1787e1fffd15b83b004be7eba0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-08-083-4/+9
|\| | | | | | | | | | | Change-Id: I4c0fd501db974fb8339944b8df845336776d80a9
| * | QMutexPool: fix memory order of atomic operationsMarc Mutz2019-08-052-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The array of QAtomicPointer<QMutex> can be initialized using relaxed stores of nullptr, since nullptr is the whole data. But once we store an actual QMutex pointer in the array, we need to publish the indirect data thus created. We did this, with testAndSetRelease(); what was missing was a corresponding acquire fence on load, without which there is no happens-before relationship between the writes performed by the QMutex ctor and the reads performed by a subsequent mutex.lock(), say, on the same data. Fix by adding acquire fences to all loads. That includes the dtor, since mutexes may have been created in different threads, and never been imported into this_thread before the dtor is running. As a drive-by, return a new'ed QMutex that was successfully installed directly to the caller, without again going through a load-acquire. Fixes: QTBUG-59164 Change-Id: Ia25d205b1127c8c4de0979cef997d1a88123c5c3 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 65b8f59e045bb41fef99b1a44f462115de65064a) (cherry picked from commit da38f0d691d9d7eacfac5fbcbd47b887bd59bd39)