Commit Graph

59927 Commits

Author SHA1 Message Date
Thiago Macieira
4141c5e221 IPC: fix cleaning up after tst_QSharedMemory tests
If a previous test in the same process or previously leaked a shared
memory or semaphore handle, tests could fail and cascade down. They
could also interfere with one another. So prevent this issue by
assigning a monotonically-increasing identifier per test function or row
tested and improving how we clean up those we did create.

This shows we need the API to explicitly clean up.

Change-Id: I12a088d1ae424825abd3fffd171db61d6b68a411
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-22 13:02:08 -03:00
Thiago Macieira
6bc3a89c90 IPC: clean up #ifdef in tst_qsharedmemory.cpp
Change-Id: I12a088d1ae424825abd3fffd171db0debf823a12
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-22 13:02:07 -03:00
Thiago Macieira
bdaf3c458c IPC: remove the rekeying optimization for System V semaphores
It's hard to maintain it with multiple backends and I don't see the need
for it.

Change-Id: I12a088d1ae424825abd3fffd171d7bf6bbdf9a99
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-01-22 13:02:06 -03:00
Thiago Macieira
b330f212a9 IPC/QSharedMemory: call QSystemSemaphore::setKey only once (not 3)
And we particularly want to avoid calling with Create twice.

Change-Id: I12a088d1ae424825abd3fffd171d6ab1fb87221f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-01-22 13:02:05 -03:00
Thiago Macieira
2c286561bb IPC: add native key support to QSharedMemory
And deprecate the non-native key support API. Qt 7 may not even store
the old, non-native key.

Documentation in a new commit, when the dust settles.

Drive-by updates to the tst_QSharedMemory::attach row names, to fix
grammar and remove spaces and apostrophe.

Change-Id: I12a088d1ae424825abd3fffd171d3025c77f94d2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-01-22 13:02:04 -03:00
Thiago Macieira
3ae052d3bb IPC: add native key support to QSystemSemaphore
And deprecate the non-native key support API. Qt 7 may not even store
the old, non-native Qt.

Documentation in a new commit, when the dust settles.

Change-Id: I12a088d1ae424825abd3fffd171d2b549eeed040
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-01-22 13:02:04 -03:00
Thiago Macieira
510e0914c0 IPC: add a function to check runtime support
Apple sandboxes restrict use of the System V / XSI IPC mechanisms. It's
currently the only restriction we check for. Attempting to use them will
result in SIGSYS delivered to the application, so we shouldn't try.

Linux system call filtration can do the same. In fact, systemd's
SystemCallFilter= options do default to SIGSYS too and it has an @ipc
group that could be used to block SysV. However, the same group blocks
the creation of pipes, so it's not in much use.

Change-Id: I12a088d1ae424825abd3fffd171d79f7cd5b2b9d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-01-22 13:02:03 -03:00
Thiago Macieira
0b79f58458 IPC: add QtIpcCommon::platformSafeKey()
This is the new implementation of how to make platform-safe native keys,
for which no past compatibility is required nor promised. Unlike when we
started in Qt 4.4, it doesn't look there are many restrictions in names
anyway.

Important differences are:
* POSIX RT: no restrictions, we prepend the necessary '/'
* System V/XSI: no restrictions, it's just a file path anyway;
  we pass absolute paths unchanged; otherwise we prepend RuntimeLocation
* Windows: no restrictions, but we do recognize Global\ and Local\
  kernel objects without munging them

The use of the RuntimeLocation may cause a warning on Unix systems
(other than Apple ones and Android) if $XDG_RUNTIME_DIR isn't set.

We do enforce the Apple 30-character limit here, otherwise you get
ENAMETOOLONG.

Change-Id: I12a088d1ae424825abd3fffd171d3a0e09e06361
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-01-22 13:02:02 -03:00
Thiago Macieira
f79b535f6b IPC: use QNativeIpcKey for QtIpcCommon::legacyPlatformSafeKey()
The implementation only has #if now for Apple compatibility; otherwise,
we're relying on the QNativeIpcKey::Type parameter, because I intend to
allow Unix systems to support both POSIX realtime and System V / XSI
shared memory and semaphores.

Most of the uses of QtIpcCommon::isIpcSupported() will be constant
expressions because they don't depend on the ipcType.

Change-Id: I12a088d1ae424825abd3fffd171d38dfb6b5de74
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-01-22 13:02:01 -03:00
Thiago Macieira
7a37083817 IPC: Long live QNativeIpcKey key
Common to both QSharedMemory and QSystemSemaphore, this will hold the
native key and will replace the concept of non-native key in those
classes.

Change-Id: Id8d5e3999fe94b03acc1fffd171c03197aea6016
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2023-01-22 13:02:00 -03:00
Thiago Macieira
a467362aa8 IPC: include the error text instead of errno code in errorString
It's much easier to tell what happened.

Change-Id: I12a088d1ae424825abd3fffd171dbeb58c46fd6d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-01-22 13:02:00 -03:00
Thiago Macieira
c9440c9ca0 IPC: handle EMFILE as an OutOfResources error
In QSystemSemaphore (QSharedMemory already has it).

When running tst_QSharedMemory::useTooMuchMemory on 64-bit Linux with
POSIX IPC, we run out of file descriptors before we run out of memory.

Change-Id: I12a088d1ae424825abd3fffd171d6f34c002b5a1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-01-22 13:01:59 -03:00
Thiago Macieira
762017f03c IPC: move the *_unix.cpp contents to the main files
It's just the setUnixErrorString() functions.

Change-Id: I12a088d1ae424825abd3fffd171d2880ebaf49c7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-01-22 13:01:58 -03:00
Thiago Macieira
eaa7528baa IPC: split the backend implementations of QSharedMemory...
Into separate classes. This temporarily compiles QSharedMemoryPosix
on most Unix systems despite defaulting to SystemV.

Change-Id: I12a088d1ae424825abd3fffd171d25efdee8d2de
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-22 13:01:58 -03:00
Thiago Macieira
75e73ea7fc IPC: split the backend implementations of QSystemSemaphore...
Into separate classes. This temporarily compiles QSystemSemaphorePosix
on most Unix systems despite defaulting to SystemV.

Change-Id: I12a088d1ae424825abd3fffd171d23191fbb6db3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-22 13:01:57 -03:00
Thiago Macieira
8b92d5a122 IPC: split the semaphore and shared memory CMake tests
The two features are independent of one another. This also exports them
to qtcore-config_p.h, but leaves the QT_POSIX_IPC macro from
qtcore-config.h alone. Those four are also included on Windows builds,
so we won't need to #if them out of Windows.

Change-Id: I12a088d1ae424825abd3fffd171d1f0ae8e8f469
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-22 13:01:56 -03:00
Thiago Macieira
7809caa924 IPC: move makePlatformSafeKey to qtipccommon.cpp
This removes the second portion of the #if mess of shared code between
QSharedMemory and QSystemSemaphore for SystemV.

Change-Id: Id8d5e3999fe94b03acc1fffd171c073c2873206e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-22 13:01:55 -03:00
Thiago Macieira
461463b75d IPC: move createUnixKeyFile to a common, private header
So we don't have to mess around with #ifs to support the build.

Drive-by replace with unlink() some calls to QFile::remove(), which
create a QFSFileEngine, to call QFSFileEngine::remove, which calls
QFileSystemEngine::removeFile. Since we've just created the file with
qt_safe_open(), we may as well use the low-level Unix function to remove
too.

Change-Id: Id8d5e3999fe94b03acc1fffd171c06c7efc0b0f0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-22 13:01:55 -03:00
Thiago Macieira
fc14f1a467 IPC: move the feature check to the ipc/ dir for tst_qsharedmemory
Change-Id: Id8d5e3999fe94b03acc1fffd171c22d2e8752ffb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-01-22 13:01:54 -03:00
Thiago Macieira
53e8982434 IPC: Move QSharedMemory and QSystemSemaphore from kernel/ to ipc/
It's not a lot of files, but it's actually more in the same dir than
mime/ does right now. I'm about to add two more files, though I'll also
merge a few more later.

Change-Id: Id8d5e3999fe94b03acc1fffd171bfe2ea36a35a7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-22 13:01:53 -03:00
Axel Spoerl
7689d4ad2f QWidgetTextControl: Ignore unconsumed mouse release events
QWidgetTextControlPrivate::mouseReleaseEvent() has early returns
implemented, e.g. when link has been right clicked or no selection
anchor has been found. These early returns, however, still consume
the event.

This leads to events getting lost instead of getting propagated:
As an example, a QLabel with rich text uses QWidgetTextControl. While
it propagates mouse press events back to its parent, mouse release
events get lost. A QLabel with plain text propagates both events
back correctly.

This patch adds QEvent::ignore() to the early return.
Since no test class exists for QWidgetTextControl, it adds a test in
tst_QLabel.

Fixes: QTBUG-110055
Pick-to: 6.5 6.4
Change-Id: I950f8c3f135793b01c59832835bb429db2282169
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-01-21 17:04:14 +01:00
Mikolaj Boc
b6224ec8fa Remove the qwasmstylepixmaps_p.h dead code
The code is now unused as svg graphics have been introduced for
window decorations.

Change-Id: Iefe4543af2483fd9ff3eb6ce15b9905620927a9b
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2023-01-21 13:45:23 +01:00
Amir Masoud Abdol
90aafa0470 Fix the broken test after the retirement of qt_parse_all_arguments
As we are now processing the arguments with
cmake_parse_arguments(PARSE_ARGV, we don't need to pass the escape
characters anymore.

Task-number: QTBUG-99238
Change-Id: Iea9cda4fe0ae56043cc4d7db29ce53d9d737d645
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-01-20 19:42:40 +01:00
Alexandru Croitor
4e70ab5eeb CMake: Work around AUTOUIC Ninja Multi-Config issue with EP examples
AUTOUIC doesn't handle relative paths to .ui files in parent
directories when using Ninja Multi-Config.

The designer tool in qttools has such a ui file. This leads to the
following error when trying to build qttools together with examples as
ExternalProjects and Ninja Multi-Config:

  ninja: error: 'src/designer/src/designer/designer_autogen/
    include_Debug/ui_preferencesdialog.h', needed by
    'src/designer/src/designer/designer_autogen:Debug',
    missing and no known rule to make it

Until cmake is fixed, we can work around the issue by not adding
designer as a dependency when building EP examples, because no example
tries to use the app.

We can't exclude all apps from example dependencies because some
modules use qt_internal_add_app for tools as well, which are called
from public CMake API and also examples.
An example of this is qtapplicationmanager.

Given that we can't exclude all apps, introduce a function to
allow skipping single targets when building EP examples.

This will allow excluding designer specifically.

The examples will now depend on a new ${repo}_src_for_examples target
rather than ${repo}_src, which will exclude skipped targets.

Task-number: QTBUG-90820
Task-number: QTBUG-96232
Task-number: QTBUG-110369
Change-Id: I2f900253bbf7bac917f2293ef604ab3ea8f298e1
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-01-20 18:21:46 +01:00
Mikolaj Boc
9b64bf0874 Handle the drop event in the wasm window element
Drop events are now handled in the wasm window element, which allows
the browser to select the drop target automatically. This also fixes
the case where drop data transfer finishes reading when a window
has already been closed and destroyed - the cancellation flag is now
owned by window so it gets invalidated as soon as window is gone.

The code has also been structured with a new DragEvent passthrough.

Fixes: QTBUG-109581
Change-Id: Ie3eb7446e2181fd540517f39397e8b35f111d009
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-01-20 18:00:26 +01:00
Assam Boudjelthia
c290e742c6 Fix qt android notifier example name for qtdoc
Rename from QtAndroidExtras/Qt Notifier to QtCore/Qt Android Notifier.

Task-number: QTBUG-110230
Change-Id: I18ad45ce85b57977f32af5fc735119df88f93144
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-01-20 16:11:30 +00:00
Assam Boudjelthia
2d5aa4980d Android: add comment to remove unused private methods in Qt 7
These methods don't seem to be used by anyone now, but not sure
how it was before, so to not run into any BiC issues, just add
a comment to remove them in Qt 7.

Change-Id: Ie30a3d2adcbbb7530d9cf72f03b78ecfa06e426c
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-01-20 18:11:30 +02:00
Christian Ehrlicher
87662bcf10 SQL tests: Fix for PostgreSQL 12 and above
The 'WITH OIDS' was deprecated some time ago and removed with
PostgreSQL 12 so we have to adjust our test table creations. Don't know
why it was used in the first place at all.

Pick-to: 6.2 6.4 6.5
Change-Id: I6e18ac01e64368b1dd64e02bcb75fa70e05467a3
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-01-20 15:51:17 +01:00
Marc Mutz
51e5a2376a QVarLengthArray: fix off-by-size() bug in growBy()
The growBy() function takes the _increment_ of the size(), so needs to
add size() to increment for the call to realloc().

Add a test which hangs (vanilla build) or explodes (valgrind build)
without the fix.

Amends 26b227e128.

Done-with: Eirik Aavitsland <eirik.aavitsland@qt.io>
Pick-to: 6.5 6.4
Fixes: QTBUG-110412
Change-Id: I7ea91342fdcb779825c88013a3f86ba6d90ef530
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-20 14:48:20 +01:00
Assam Boudjelthia
a375f2e275 Fix build errors in manual tests
various fixes like missing includes, linking, obsolete API usage, etc.

Pick-to: 6.5
Change-Id: I786bff396933b87cd39559ac8964d386ef368df1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-01-20 15:48:20 +02:00
Assam Boudjelthia
dbb622a38d Android: print jni exceptions from Qt instead of ExceptionDescribe()
This makes the exceptions prints tagged with the app's name/tag,
and also can allow QTest::ignoreMessage() to handle exceptions as now
it cannot filter messages out because they're printed by the Android
system.

Pick-to: 6.5
Change-Id: I9f5132b9ec5b5cd8fb35707eaaf68aa517f417ec
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-01-20 13:48:20 +00:00
Christian Ehrlicher
e04af5b9ea SQL: use qsizetype and range-based for loops where possible
Some public functions are still using int instead qsizetype which
can't be changed until Qt7.

Change-Id: Ib6f210c344acce9f3836e8a5493a741eb8b2b385
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-01-20 13:16:35 +00:00
Marc Mutz
8d5ff75774 QtCore removed_api.cpp: fix missing instruction comment in 6.5 block
Thanks to Ahmad for noting.

Amends 6bc227a06a.

Pick-to: 6.5
Change-Id: Ie6191bfc21d69f88a9a135f0d5f6b4fa8b09e8ad
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-20 13:44:27 +01:00
Ville Voutilainen
fee977b18b Remove android tag from QtOpenGL examples
Task-number: QTBUG-110230
Change-Id: I6997c1c0eb91f4ee6ff9e9579a742c6617310267
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-01-20 06:42:45 +00:00
Ville Voutilainen
e8626fb1fa Remove android tag from Widgets examples
Task-number: QTBUG-110230
Change-Id: Ic03fcafcf6a9beea3e8c847ede8eaff924b8788b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-01-20 06:42:32 +00:00
Ville Voutilainen
c5bd2b6c12 Remove android tag from QuickControls1 examples
Task-number: QTBUG-110230
Change-Id: Ib97ce416c56de7dcb3a47013c539845bd9206f7a
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-01-20 06:42:17 +00:00
Thiago Macieira
8772005a4b tst_QUrlQuery: replace a few QVERIFY(~~ != ~~) with QCOMPARE_NE
Pick-to: 6.5
Change-Id: I69ecc04064514f939896fffd17376aae3b8072b5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-01-20 00:19:22 -03:00
Thiago Macieira
fc8dad2f10 QUrlQuery: add missing move constructor
It wasn't added when this class was created in 5.0 because we couldn't
add move constructors and still keep the ability to compile Qt with
C++98 compilers. We've forgot to correct this shortcoming since 5.6.

Fixes: QTBUG-109842
Pick-to: 6.5
Change-Id: I69ecc04064514f939896fffd17376b8243b73c52
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-01-20 03:19:21 +00:00
Thiago Macieira
3d584b1093 QUrlQuery: fix operator== for emptied object case
If an object had elements and then was emptied, it will have a non-null
d pointer, which wasn't taken into account in the comparison.

Fixes: QTBUG-109840
Pick-to: 6.5 6.4 6.2
Change-Id: I69ecc04064514f939896fffd17376aa18184653c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-01-20 03:19:19 +00:00
Thiago Macieira
d298ec3a6f Fix build with GCC 13: target specific option mismatch
range_access.h:274:5: error: inlining failed in call to ‘always_inline’
‘constexpr std::size_t std::size(const _Tp (&)[_Nm]) noexcept [with _Tp
= short unsigned int; long unsigned int _Nm = 34]’: target specific
option mismatch

qsimd.cpp:367:35: note: called from here

Pick-to: 6.5
Change-Id: Ide4dbd0777a44ed0870efffd1739097c71991822
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-01-19 12:03:25 -08:00
Edward Welbourne
e7c7902e73 Let QLocaleData::numberToCLocale() know the type of number
Passing a NumberMode lets it exclude floating-specific details for
integer parsing. For now this is only partially exploited, but later
work shall make more use of it.

Fixes: QTBUG-81756
Change-Id: If11d3a5a122d0714f645e58a51ee0d0c47ebe61d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-01-19 18:46:35 +01:00
Edward Welbourne
2d7b9b02e9 QRoundingDown: make the numerator a template parameter
It's always a constexpr (or static const that could be constexpr; fix
the cases of this while I'm here) or an integer literal, so we can, so
we might as well.

Change-Id: I61e9bcdb27f4a05f011ccce16b5f15d0dade0782
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-01-19 17:57:04 +01:00
Amir Masoud Abdol
5c40cb0f1a Fix a bug in -redo where -redo was not considering new options
In addition to the fix, I've removed some legacy codes in the
`configure` file and delegated most of the work to
the `QtWriteArgsFile.cmake` which was being used by `configure.bat`. I
am not sure how this was supposed to work before since it was not really
working, but now, `config.opt` lives in the build directory, together
with `config.opt.in` (a template file), and the `config.redo` (and
`config.redo.in`) which holds the full redo command. The template files
are being used to preserve the quoted variables and to help
QtWriteArgFiles process the opt files more consistency.

Also fixed an issue on Unix, where ./configure was failing to run if
its path contained spaces, e.g., `Qt Src/qt5/configure`.

Fixes: QTBUG-108287
Change-Id: I9843b690a1fd3177a93e55e08a3484a4c85ba2e8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-01-19 13:19:20 +01:00
Marc Mutz
e3f230e7be Optimize QXmlStreamWriterPrivate::doWriteToDevice(QLatin1StringView)
Use a stack buffer, and perform the recoding from L1 to U8 in chunks.

Solves the L1 case of

Task-number: QTBUG-109284
Pick-to: 6.5
Change-Id: Ia9ac7d8b27fd452d24d9e27f0575f9fc83b6dcbc
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-19 11:55:23 +00:00
Axel Spoerl
2ae75c2e6a Fix CMakeLists.txt of Style Plugin Example (broken on macOS)
Add TARGET instruction in property setter, used in debug mode on macOS.

Task-number: QTBUG-107842
Task-number: QTBUG-109227
Change-Id: I8704b7009c36ea8ddbf8773abfaf2b5f34f728ac
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-01-19 10:50:04 +00:00
Simo Fält
41ab4c2f55 COIN: Sign Windows binaries only with Packaging configs
We wasting time and resources by signing binaries that
are for internal use only.

Change-Id: Ic3271af7f11dac05979ff14a7ffa3f9075fe0ecb
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2023-01-19 09:16:41 +02:00
Jörg Bornemann
97165dbfa1 Revert "Revert "CMake: Expose generated resource files to IDEs""
This reverts commit 6a18bc8090.

Reason for revert: The reason for the original revert has been fixed
in c146d25a87.

Change-Id: I996960633dc75a7ef3ae12ab7f759658af7932c5
Reviewed-by: Xavier BESSON <developer@xavi-b.fr>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-01-18 20:11:28 +00:00
Marc Mutz
47abdabe2c QHttp1Configuration: fix UB (inactive union member access)
Any QHttp1Configuration object created has 'ShortData data' as active
member. std::exchange()ing or qt_ptr_swap()ping 'Private *d', then, is
accessing the inactive member of the union, and that's UB.

Fix by swapping and copying the whole union, as opposed to any of its
members, and, in the move constructor, activating Private *d.

This is now safe, as assigning to 'd' ends 'data's life-time and
starts 'd's. Even if we assign a well-formed object to a moved-from
object, we either swap or copy the whole union, so SEP. For
self-move-assignment in the moved-from state (Hinnant Criterion),
we're using std::swap() on the whole union, so SEP.

In addition, activating `Private *d` in moved-from objects means that
a future ~Public's use of unconditional 'delete d' won't invoke UB,
either.

Thanks to Peppe for insisting on fixing this.

Pick-to: 6.5
Change-Id: Ic1323b8416d6b17ae21768c625de1daba0944133
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-01-18 18:19:25 +00:00
Marc Mutz
7ca8cb89e6 QXmlStreamReader: fix spelling of PrivateConsructorTag
Found in API review.

Pick-to: 6.5
Change-Id: I347ae3cc6a51095dddaba617adc2f63612578ef3
Reviewed-by: Sona Kurazyan <kurazyan.sona@gmail.com>
2023-01-18 19:19:25 +01:00
Tor Arne Vestbø
2813e2814e Respect custom QWSI event handler when delivering synchronous events
Pick-to: 6.5 6.4
Fixes: QTBUG-110268
Change-Id: I25195904cfc18d593db1be713b6e899e55eb922f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-01-18 17:23:13 +00:00