summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Use QLatin1String::arg() directlyEdward Welbourne2021-12-091-18/+12
| | | | | | | | No need to wrap the QLatin1String in a QString() to get at arg now. Change-Id: Iac90e052b88077b9c2bd3e7eca6bc31935baa4b8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Tidy up in QTapTestLogger::addIncident()Edward Welbourne2021-12-091-9/+7
| | | | | | | | | | After we've checked m_wasExpectedFail, we might as well set it promptly, since one of our earlier checks is on the same condition. Explain what that check is about, fix a typo in another comment and make the local ok variable const, since it can be. Change-Id: Ie04c0ad4248e47b116d3e22046116d39cf2ac6df Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* TAP test logger: avoid dangling space on TODO and SKIP linesEdward Welbourne2021-12-091-6/+20
| | | | | | | | | If an incident has an empty description we produced output with a dangling space. Avoid triggering the inanity 'bot with those. Reorganise the code to save some duplication. Change-Id: I1dc29fa8ad4449a4584f11dddcf002e405cd9238 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove spurious class prefixes from subclass codeEdward Welbourne2021-12-093-9/+9
| | | | | | | | | The subclass's code can refer to the base's public enums without needing the (long) class prefix. Change-Id: I4824440d216695aee9345776faba2e510130425e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Avoid duplicated code by reworking #if-ery around an if/elseEdward Welbourne2021-12-091-9/+4
| | | | | Change-Id: I08376d2dfd071989fab9ee18dbb90ab8670ed20f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* TAP test logger: skip XFail results as well as pass after an XFailEdward Welbourne2021-12-091-1/+2
| | | | | | | | | | The rationale for skipping pass after XFail is "to emit a single test point for" the test; emitting several XFails violates that aim. Task-number: QTBUG-96844 Change-Id: Ia8626dfc2dded234b3aa530fc2dc2324f1e28400 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Ignore blackisted Pass and XFail when ignoring their plain formsEdward Welbourne2021-12-092-4/+4
| | | | | | | | | | | It makes no sense to include output for a blacklisted test that would have been excluded had it not been blacklisted. Task-number: QTBUG-96844 Change-Id: I164e0c26a921101cbf8986904851260d181be00f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Make Skip an incident in test loggingEdward Welbourne2021-12-099-87/+75
| | | | | | | | | | | | | | | Skip ends the test (albeit inconclusively). Rearrange the enums in the abstract logger, move code to handle skip between relevant function and tidy up various things that became simpler as a result. Also reorder the message enum, and its switches, to separate testlib's internals from the usual Qt messages, and put each group in ascending order of severity. Task-number: QTBUG-96844 Change-Id: I2c7a634b9f849830d64eafa750155e66e244b729 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Implement QTest::qWait() in terms of QTest::qWaitFor()Edward Welbourne2021-12-091-18/+2
| | | | | | | | A comment in the existing implementation encouraged doing so, but for a bug in GCC 6. We no longer care. Change-Id: Ia8cb2bc5e184510e3d756e8bbfe6bc0e852e6830 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace out-of-date comment on QTRY_IMPL(), about qWaitFor()Edward Welbourne2021-12-091-3/+9
| | | | | | | | | | | | | | | | | | A comment on QTRY_IMPL() helpfully mentioned the bug number of the issue that prevented us from using qWaitFor; and MSVC < 2017 are no longer supported so it looked possible to make the change suggested. However, the implementation has, in the mean time, grown some features not (currently) provided by qWaitFor(), so update the comment. In the process, fix one minor error in QTRY_TIMEOUT_DEBUG_IMPL() where parentheses enclosed the wrong text; (2 * timeoutValue) would not produce the intended result if timeoutValue were 1 + 500, for example. The macro parameter should be enclosed, not the expression using it as parameter to a further macro. Task-number: QTBUG-59096 Change-Id: Ie16e297def9d1f983cd5964bc628b2c3c0aaecda Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Refactor QTEST*_MAIN() implementationsEdward Welbourne2021-12-091-59/+32
| | | | | | | | | | | | | | | | | | The various variants duplicated some rather complex code around varying setup in the middle. Rework in terms of a macro that defines main() and takes the setup code as a parameter. That setup code also had some common structure, so package that in a setup macro that takes the class to be used. Reworked various testlib selftests that were using QTEST_MAIN_IMPL(); change to use the new QTEST_MAIN_WRAPPER() and TEST_MAIN_SETUP(). These might be better dealt with by supporting a second form of the initMain() test-setup function in the test classes, that takes references for argc and argv, to let a test massage its command-line options. Change-Id: I7fb16b38d51c80ba2f5c9c82f3b7a37ffc636795 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Tidy up testlib's parsing of -callgrind parameterEdward Welbourne2021-12-091-9/+12
| | | | | | | | | | Invert a condition to turn a nested if (that was missing one of its layers of braces) into an else-if chain, split some long strings to limit line length. Change-Id: I10d90487a09affe981aa11c3588281aeb3666df5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: Mark the new deployment API as being in Technical PreviewAlexandru Croitor2021-12-098-0/+30
| | | | | | | | Amends 22c92f39670d0376478cc2e73a17307508f86692 Task-number: QTBUG-98545 Change-Id: Ifaa7e4884f0eb1caa6d3d4906a2701f8fa5e43c2 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Fix some of the CMake commands not using the right doc groupAlexandru Croitor2021-12-092-2/+2
| | | | | | | | Augments e0ecb0ded21082f4e00ee77411339009cb1294a4 Pick-to: 6.2 Change-Id: I4eea51b66ffa5ffe45faa3c51a4b65a526dd73e7 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* QVarLengthArray: make reallocation strongly exception safeMarc Mutz2021-12-092-27/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code had several bugs: - it immediately clobbered *this with new state, before having copied over the elements from the old to the new buffer - when buffer relocation threw, it would keep the new (partially-filled) buffer and throw away the old - it unconditionally used std::move() for non-relocatable types, making it impossible to restore the original buffer when a move throws Instead of clobbering *this with new state, do all the work on the side and change *this only once the reallocation has happened successfully. Also use q_uninitialized_relocate_n() and unique_ptr in the implementation to simplify the code. The former got the necessary update to use std::move_if_noexcept() instead of an unconditional std::move() for the non-relocatable case. [ChangeLog][QtCore][QVarLengthArray] The append()-like functions are now strongly exception safe. This means reallocation will now use copies instead of moves, unless the value_type has a noexcept move constructor. Fixes: QTBUG-99039 Change-Id: I031251b8d14ac045592d01caed59d4638c3d9892 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QVarLengthArray: implement append() via emplace_back()Marc Mutz2021-12-091-12/+5
| | | | | | | | Less code duplication, means less functions to move into the upcoming QVLABase. Change-Id: I67a817c971a4e5a81ae45ff30282878be1bde2aa Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QVarLengthArray: inline some trivial reallocate() wrappersMarc Mutz2021-12-091-15/+3
| | | | | | | | | | | These functions don't deserve to be defined outside the class body, as they're trivial wrappers around reallocate(). Cleans up the header somewhat, in preparation of the upcoming QVLABase/QVLAStorage split. Change-Id: Ib4062eca4214a67e67f472a7c1e4bf4d9813c8a4 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QVarLengthArray: use C++14 4-arg std::equal()Marc Mutz2021-12-091-6/+1
| | | | | | | | | Simplifies the code, since we now need neither the manual size check, nor the warning fix (checked iterator macro) for MSVC. Change-Id: Ic267c66eb4568d2db8d9c9ccad0ce7e1a5cc3373 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Re-enable parsing Qt code with LLVM (Qt for Python)Friedemann Kleint2021-12-091-1/+1
| | | | | | | | | | Exclude the check introduced by 0dc6cc055174a0556f2e41ca269013b3a7056c86 for clang compilers since there seems to be no equivalent option -permissive- for the MSVC emulation. Change-Id: I0468d8e2f2c988e604be6960f1b1f4760ea0c400 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* QLocale: Extend support for language codesIevgenii Meshcheriakov2021-12-096-357/+533
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit extends functionality for QLocale::codeToLanguage() and QLocale::languageToCode() by adding an additional argument that allows selection of the ISO 639 code-set to consider for those operations. The following ISO 639 codes are supported: * Part 1 * Part 2 bibliographic * Part 2 terminological * Part 3 As a result of this change the codeToLanguage() overload without the additional argument now returns a Language value if it matches any know code. Previously a valid language was returned only if the function argument matched the first code defined for that language from the above list. [ChangeLog][QtCore][QLocale] Added overloads for codeToLanguage() and languageToCode() that support specifying which ISO 639 codes to consider. Fixes: QTBUG-98129 Change-Id: I4da8a89e2e68a673cf63a621359cded609873fa2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add unit test for moving of opaque widgetsVolker Hilsheimer2021-12-081-2/+3
| | | | | | | | | | | | | | | Expose QWidgetRepaintManager's data structures so that we can write unit tests, and verify that they are correct after moving opaque widgets (which triggers the accelerated move code path). Improve the compareWidget logic to not rely on screen grabbing (which requires permissions), but instead use QPlatformBackingStore's toImage function, which is faster and more reliable, and also doesn't require us to show the UI we want to grab full screen in order to avoid issues with overlapping windows etc. Change-Id: Iff2ea419f03a390ab6baca26814fef6ff45f7470 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Windows QPA: Fix cursors getting out of sync after restoring override ↵Friedemann Kleint2021-12-085-5/+24
| | | | | | | | | | | | | | cursors on native windows Introduce a flag to QWindowsWindow which forces the cursor to be applied after restoring override cursors. Fixes: QTBUG-98856 Pick-to: 6.2 5.15 Change-Id: Id62cdc2dd01f45324503a542446b1c11a1fe6f44 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Keith Kyzivat <keith.kyzivat@qt.io> Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Callbacks for begin/end of a frame on OpenGLEskil Abrahamsen Blomfeldt2021-12-083-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The background for this is that when running Wayland, the Mesa driver has an issue which makes it crash if we call eglDestroySurface() while we are rendering to it. This is not according to the documentation, and it only seems to happen on Mesa and only on Wayland, so it is probably related to something in the Wayland implementation in the driver. Since this driver is very popular, we want to work around it, which can easily be done using existing locking mechanisms in the Qt Wayland QPA plugin. But in order to do so, we need reliable callbacks for the start and end of a frame. The RHI already has this, so we just need to channel the information to the QPA plugin. Having beginFrame/endFrame hooks in the QPlatformOpenGLContext could be useful in other cases as well, especially knowing that there are OpenGL implementations that require some extra thread protection. QPlatformSurface would be a more general location for these hooks, but since the issue is only seen on OpenGL and multi-threading is handled more explicitly in other APIs, we don't want to expose this API in a more general location than necessary. Task-number: QTBUG-92249 Change-Id: I97ce7d4f744c4b28eec457e919d1c9652ff00079 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Code tidies: improve variable naming and add const where possibleVolker Hilsheimer2021-12-081-19/+17
| | | | | | | | | Remove obsolete check for valid sourceRect, we never get into the accelerated code path if it's not. Pick-to: 6.2 Change-Id: I872685fca8cba3a09ed856d727d5baafddee161b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fall back to include() method for finalizers with CMake 3.17 or earlierCraig Scott2021-12-081-5/+9
| | | | | | | | | | | | | | | | Functionality is being added in other repos which require finalizers to be run for non-static builds. That means we now need to ensure finalizers always run even with CMake versions before cmake_language() was added. The fallback method of writing to a file and including it is slower, but that's better than missing important functionality altogether. Task-number: QTBUG-98545 Pick-to: 6.2 Change-Id: Ic8668c91c26d0c30de084b1b803032088c10fcf4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add documentation for CMake deployment supportCraig Scott2021-12-0810-5/+717
| | | | | | Task-number: QTBUG-98545 Change-Id: Ifd5c0f4ce278c683bb0d3ba6a259ec14a7f24181 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Add CMake deployment supportCraig Scott2021-12-084-0/+561
| | | | | | | Task-number: QTBUG-98545 Change-Id: I581c1173cdfc92c09fd2cf0bbe7ec6bc8d52b868 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Recognize system apps also when apk has parent directoryTinja Paavoseppä2021-12-081-2/+7
| | | | | | | | | | | | | When checking if the apk is being deployed from system partition, account for possibility of the apk not being installed directly under /system/app or /system/priv-app, but in a directory of its own. Otherwise, system applications that are not directly under system app/ priv-app directories will not be recognized as system apps, meaning they will not use the system library path to load their libraries. Pick-to: 6.2 Change-Id: I1e778b18cae3c0406e087b8c78fd31d521f7be73 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Fix typo in QAbstractItemModelTesterAndreas Buhr2021-12-081-1/+1
| | | | | | | | | | When recursively checking children in QAbstractItemModelTester, the currentDepth of recursion was incorrectly increased. This patch fixes it. Pick-to: 6.2 5.15 Change-Id: Ia79508f358e2fcb6b90780a79baec053522e871c Reviewed-by: David Faure <david.faure@kdab.com>
* QVarLengthArray: fix size update on failed append()Marc Mutz2021-12-081-6/+5
| | | | | | | | | | | | | If the in-place constructor throws, the old code had already updated the container's size(). Fix by delaying the update to after the in-place construction. [ChangeLog][QtCore][QVarLengthArray] Fixed a bug whereby a failed append() would leave the container with an inconsistent size(). Pick-to: 6.2 5.15 Change-Id: Ief1e668d945149bd8ba96c8af1398baaa7876880 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QCoffParser: Replace windows.h with qt_windows.hYuhang Zhao2021-12-091-4/+1
| | | | | Change-Id: I9aeeb2cef4d068020e0c176a70ad86c9e28b0e68 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Widgets: setTransientParent() when a QMenu is a windowLiang Qi2021-12-082-0/+26
| | | | | | | | | | | | | On some platforms, such as X11 and Wayland with some compositors, QMenu could be a popup window, which should be set a transient parent to get relative position, which is requested by Wayland. Added transientParentWindow() for QMenuPrivate like QDialogPrivate. Fixes: QTBUG-68636 Pick-to: 6.2 Change-Id: I6d8880cb008ecf61a4c005898b38e3953379a13d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* evdevkeyboard: Try opening as read-write firstLaszlo Agocs2021-12-082-1/+6
| | | | | | | | | switchLed writes to the device, and so O_RDONLY cannot be correct. Change-Id: If79814804bcd3c6fb01617be9f1a73e54b9563bd Pick-to: 6.2 5.15 Fixes: QTBUG-80653 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Revert "Compile: Work around false positive on gcc >= 900"Joerg Bornemann2021-12-081-1/+1
| | | | | | | | | | This reverts commit d62e9d3c5bd9d3aae5f4b72ed0688dcbd02134a7. Reason for revert: The -Wstringop-overread option was introduced in gcc 11. This fixes the build for gcc 9 and 10. Change-Id: I96ab5f917d6200cb1681fe6236f1fd4630ef4f7d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTableWidget doc: remove wrong comment for itemExpanded()Christian Ehrlicher2021-12-081-3/+0
| | | | | | | | | | Since Qt5.1 (80fa4b6c8ef) expandAll() emits expanded() but within this change, the comment in itemExpanded() was forgotten. Pick-to: 6.2 Pick-to: 5.15 Change-Id: Ic487e5f8999d6af27a4747b861464058faf03889 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Implement fetching physical QStorageInfo::blockSize() under WindowsKarsten Heimrich2021-12-084-1/+240
| | | | | | | | | | | | | | | | | | This is implemented in two passes, first we try the older and always available DeviceIoControl() function. This works most of the time, though it might fail for example for storage devices attached via USB. In this case, we try to dynamically load the newer NtQueryVolumeInformationFile kernel function. Since this is probably more expensive, we do this as fallback. [ChangeLog][QtCore][QStorageInfo] The QStorageInfo::blockSize() will now report the physical block size of a storage device under Windows. Network mapped drives are not supported. Fixes: QTBUG-93976 Change-Id: I08b5b879e5bf79c025e2e305196ec5c5fce8b20f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* wasm: improve clipboard supportLorn Potter2021-12-083-77/+336
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for Clipboard API Add clipboard manual test Also includes these fixes: - improve clipboard use for chrome browser - make QClipboard::setText work - html copy and paste - image copy/paste Chrome browser supports text, html and png To use the Clipboard API, apps need to be served from a secure context (https). There is a fallback in the case of non secure context (http) - Firefox requires dom.events.asyncClipboard.read, dom.events.asyncClipboard.clipboardItem and dom.events.asyncClipboard.dataTransfer to be set from about:config, in order to support the Clipboard API. Change-Id: Ie4cb1bbb1dfc77e9655090a30967632780d15dd9 Fixes: QTBUG-74504 Fixes: QTBUG-93619 Fixes: QTBUG-79365 Fixes: QTBUG-86169 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Fix incorrect rendering when moving widget into screenVolker Hilsheimer2021-12-081-1/+1
| | | | | | | | | | | | When the widget we are moving in was previously outside of its parent's clip rect, then we cannot use the accelerated move code path, as there are no pixels to bitBlt from the previous to the new area. Pick-to: 6.2 Task-number: QTBUG-26269 Task-number: QTBUG-98151 Change-Id: I324c6111de27cdd14cf8de8632a980aa351cc123 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Test for nullptr before dereferencing the screenVolker Hilsheimer2021-12-082-2/+2
| | | | | | | | | | | | | Touch event processing might still be ongoing even after the screen has been disconnected. If that screen was also the primary screen, we would dereference nullptr. Check for nullptr to avoid potential crashes during shutdown. Fixes: QTBUG-95192 Pick-to: 6.2 5.15 Change-Id: I49ccd30c4126fe12cf5bb675e532e6e59b40b9c1 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Doc: Reword, fix typos and some formattingIvan Tkachenko2021-12-082-7/+8
| | | | | Change-Id: I0929f7653cb07665842d0aa7bf18dc80471febdc Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* QVarLengthArray: remove unneeded copy in replace()Marc Mutz2021-12-071-3/+2
| | | | | | | | | | | | | | | QVarLengthArray is neither implicitly shared, nor does it feature a magic resize() on out-of-bounds. Therefore, data() doesn't detach(), so 't' remains stable. The only reason for the copy, then, would be if T wasn't self-assignment-safe, but we don't support such types. Remove the copy. Change-Id: I8dd12e1c9b8131ae17d641354fe362554062b78d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QVarLengthArray: don't mix iterator/const_iterator in offset calcMarc Mutz2021-12-071-4/+4
| | | | | | | | | | | | The functions aren't const so begin() will return a mutable iterator. The function arguments, however, are const_iterators. It doesn't matter for QVLA, which isn't implicitly shared, but code hygiene suggests to use cbegin() instead, to compare const_iterators to const_iterators. Change-Id: I9bfa993780ee4b68d13f6b6410772b0f1ccedad3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QVarLengthArray: port internal users from at() to op[]Marc Mutz2021-12-071-2/+2
| | | | | | | | | In preparation of splitting the class into QVLABase and QVLAStorage. Task-number: QTBUG-84785 Change-Id: Ic0da6c2e110a5b979b78989616b9a2cb0f27463b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QThread::create(): request interruption and join on destructionGiuseppe D'Angelo2021-12-071-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If one destroys a running QThread, so far the behavior has been to crash (à la std::thread) -- assuming the thread hasn't already signalled that it has finished. This behavior is hostile to solutions such as using QThread::create(), which always require a wait() before destroying the thread object. We can use the opportunity to change the behavior without breaking any valid code. Instead of crashing, inside QThread's destructor we can ask the new thread to quit, and then join it (à la std::jthread). This simplifies the implementation of long-living runnables and the code that manages them. Deploying this solution for the whole QThread class may not be entirely painless. While no correct code would work differently with the proposed changes, incorrect code that deletes a running thread would no longer crash "loudly" -- instead, it might deadlock "quietly", have memory corruptions, etc. Hence I'm limiting this approach to only the threads created by QThread::create(), at least for the time being. This also side-steps perhaps the biggest problem of generalizing the approach, which is that placing such interrupt+join logic into~QThread's destructor would cause it to be run _after_ a QThread subclass' own destructor has run, destroying the subclass' data members too early. This might create an antipattern if one chooses to subclass QThread. With create(), a subclass in question exists, and it indeed has NSDMs, but it's entirely under our control (in fact, I'm placing the logic just in its dtor). [ChangeLog][QtCore][QThread] Destroying a QThread object created by QThread::create() while the thread that it manages is still running will now automatically ask that thread to quit, and will wait until the thread has finished. Before, this resulted in a program crash. See the documentation of QThread::~QThread() for more details. Change-Id: Ib268b13da422e277ee3ed6f6c7b2ecc8cea5750c Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* uic: Generate parameters for ambiguous signalsFriedemann Kleint2021-12-075-6/+47
| | | | | | | | Fixes: PYSIDE-1720 Pick-to: 6.2 Change-Id: I71b77db73471bdec7826bf69c7df521d7686537e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Revert optimizations and fixes for moving/scrolling overlapped widgetsVolker Hilsheimer2021-12-072-80/+28
| | | | | | | | | | | | | | | | | This reverts the QtWidgets changes made in commits 22634e00794e72d68e7578e1962f9f2023870749 and 5b09346cf4322704a866f253b911d467c40df3ba while keeping the auto tests introduced in the former commit. Both commits introduced rendering errors when moving widgets out of or into areas in which they are obscured. Before we apply any further optimizations to this code we need thorough auto test coverage. Task-number: QTBUG-98151 Task-number: QTBUG-26269 Pick-to: 6.2 Change-Id: I9cb82b73776daed59ea0e9f51ff7ddef1c7265b6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QVarLengthArray: merge remove(idx [,n]) into one functionMarc Mutz2021-12-072-16/+1
| | | | | | | | remove(i) is the same as remove(i, 1), and the extra 'n' argument is of trivial type, so it's ok to default it instead of overloading. Change-Id: Id926cd63fde518e002684a41e055edc1004247a4 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QLogging: mark all warning() and critical() functions as coldMarc Mutz2021-12-071-0/+6
| | | | | | | | | Previously, only the printf-style overloads were marked as such. Saves ~7KB in QtCore text size on Linux AMD64 GCC 11 C++ 20 builds. Change-Id: I4ed480e48060b87968f3d15bb5a84bdbcf70a647 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVarLengthArray: centralize index checkingMarc Mutz2021-12-071-13/+22
| | | | | | | | | Factor the assertions relating to sizes and indexes into an inline function, verify(). This hopefully reduces the string data generated for assertions to the bare minimum. Change-Id: Iad5c2e587ad189e7e1a62b9ca61ada4282c44f51 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMultiHash: fix erase returning the wrong iteratorMårten Nordheim2021-12-071-2/+3
| | | | | | | | | | | | When deleting the last item in a chain, without it being the last item in the chain, then we re-use the iterator which was passed in as an argument. This is wrong if we detached earlier in the function, and means we return an iterator to the previously shared data. Pick-to: 6.2 Change-Id: I7da6309e23a32073da59e7da0cbfd1d16734f1ca Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>