14139 Commits

Author SHA1 Message Date
Sona Kurazyan
ee349ffba0 QFuture: fix handling of cancelled continuation chain
To support cancellation of continuations attached via the parent future,
for each future returned by a continuation we store a pointer to its
parent (i.e. future the continuation is attached to). Later, before
executing a continuation, we go through chain of parents and check if
any of them is cancelled. However, if one of the parents is destroyed
while the chain is executing, the next continuations' parent pointers
will become invalid. So storing the parent pointers isn't safe.

This commit changes the logic of handling the cancelled continuation
chain in the following way:

- Instead of storing a parent pointer in the continuation future's data,
  we do the opposite: we store a pointer to continuation's future in the
  parent.
- When a future is cancelled, we mark all continuation futures in the
  chain with a flag indicating that the chain is cancelled.
- To guarantee that the pointers to continuation future's data don't
  become invalid, we clean the continuation (that stores a copy of its
  future's data and keeps it alive) only when the associated promise
  is destructed, instead of cleaning it after the continuation is run.

Fixes: QTBUG-105182
Fixes: QTBUG-106083
Change-Id: I48afa98152672c0fc737112be4ca3b1b42f6ed30
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 24dedaeaa1a94bfe9ade2da2a2c9aa112241b07a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-20 23:18:40 +00:00
Tor Arne Vestbø
fab25293b3 windowflags: Report QWindow compound window states
Change-Id: I44b923df6851d0f51ac39bcbb4a569cb2fde775d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 6fc751aedf31111f833349fa743c23dc2e95c39a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-20 14:35:18 +00:00
Vladimir Belyavsky
70e33a585c QTextLayout: fix maximumWidth() for a text containing line separator
When laying out, we need to increase layout's maximum width _only_
if the previous line was not explicitly wrapped by a line or paragraph
separator, or if the current line's width is greater than the
previously accumulated layout's maximum width.

Fixes: QTBUG-89557
Fixes: QTBUG-104986
Change-Id: Ib7cc4b9dda8f20166dcbd5cfd3b56424bb33d14a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 013c346a8dcbd618febb07884c64c740daf9754d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-20 13:35:05 +00:00
Liang Qi
eb8aab9b60 tests: improve tst_gestures on GNOME
There are some issues when testing QGraphicsView on GNOME(xorg)
overlapping with the default top bar. This change only move
the view a bit.

Notes:

* There is no CentOS in CI any more.
* panelPropagation() and panelStacksBehindParent() failed in CI
and local vm on Ubuntu 20.04, but only in CI on Ubuntu 22.04.

For example, we can turn the top bar off:

In Extension Manager, install Just Perfection, and disable Panel
in Visibility in it, all tests will pass too.

Task-number: QTBUG-84258
Task-number: QTBUG-103054
Change-Id: I05c262540c85af00182cd142760c4a29554b04c9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 571e7a41f55d60fef019ea7106213ffe37d5eb16)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-09-20 07:32:24 +02:00
Allan Sandfeld Jensen
0459b572b3 Fix flaky FP32x4 test
The composition implementation may act unexpectedly on Inf or NaN input
values. This change avoid those values, without changing the current
implementation.

Fixes: QTBUG-101236
Change-Id: I8e4ee67f53093b7f81e014b28d8a028ba2ddcc47
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 0e90bdbaa43b05a0c0711c78c749bb8379efa755)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-16 23:09:17 +00:00
Thiago Macieira
db5fc3711b tst_QFile::setPermissions/Unix: test both chmod() and fchmod()
On Unix, we have the fchmod(2) system call that changes the permissions
of an open file descriptor. This commit adds a test for that, by not
closing the QFile before setPermissions().

Change-Id: If5d5ef6220874ae8858efffd171255b9f20ed501
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 864fbd65828e0e84e588c896d778ae523a30e97b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-16 18:15:05 +00:00
Thiago Macieira
bc2546ba5f tst_QFile::setPermissions: add QScopeGuard to remove temporary file
Change-Id: If5d5ef6220874ae8858efffd17125580b5943cc2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 0193b4d2193b989d44dd28deda6dce12ae11ca4e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-16 18:14:58 +00:00
Thiago Macieira
ea9e8cc7e0 QFileDevice: clear cached permissions on setPermission()
In theory, if we succeed, the permissions should be what we set, but
let's not make that assumption. And if we failed, it might be because
the file disappeared or something else, so re-stat()ing the file is a
good idea.

Fixes: QTBUG-7211
Change-Id: If5d5ef6220874ae8858efffd171255506b7bbee0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 4b997d1851bc62b9a1eb761f08d3b22c85bb0b51)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-16 18:14:49 +00:00
Mårten Nordheim
f2c00dd038 QNetworkReplyFileImpl: Don't emit 'finished' in the ctor
Fixes: QTBUG-105618
Change-Id: I3bd36fbd5818d54088098e750643c3e2de30496e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 68f641095c5403925e49954aea0e65c4574121e0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-16 16:52:02 +00:00
Konrad Kujawa
e1db632ad9 Remove preprocessor conditionals for chrono include
__has_include(<chrono>) is always true, because C++11 chrono include
is required since 6.0.

Change-Id: I50cb92571bf4f1f86e2f3f2b5f486dd3c3f30f4a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ec2af0a9df0ac7bf9036f59a94ac3f3ef45c6740)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-16 11:12:41 +00:00
Jani Heikkinen
7505ff1321 Bump version to 6.4.1
Change-Id: Ic0925baf2b1d0060ffcb5dbd5c59b18a46674178
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2022-09-16 10:35:23 +03:00
Liang Qi
1ce75ea7de tests: blacklist tst_QSocks5SocketEngine::passwordAuth() on all Ubuntu
Task-number: QTBUG-106020
Change-Id: I98de5b890d23ff6721e3e5f2644a3cf73a532e6c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 6329fed0a8721a530d9dc485ecc5611a22db59d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-15 11:47:55 +00:00
Tor Arne Vestbø
b76dffec3c Don't rely on synthetic mouse events in updateFocusChainWhenChildDie test
Synthetic mouse events are not reliable, as the platform might restrict
synthetic mouse moves. In addition, the WM might automatically activate
the window when the other window is hidden, which makes the EXPECT_FAIL
flakey.

Since the test was not written to test window activation, let's just
explicitly activate the window.

Fixes: QTBUG-23699
Change-Id: I0ac1d3bc0658dfbd600a1f5d960839860be6dd2c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 2e58e242b436d0d462748546d4451f6365de4743)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-09-15 08:40:23 +00:00
Mårten Nordheim
4f26cd2f9e Http: Don't clear (de)compressed data on error
Some errors, such as 404, may still present useful data. As opposed to
errors such as 'RemoteDisconnected'. So, just keep the data around until
the reply is deleted.

Fixes: QTBUG-106573
Change-Id: I6c86b5a55a45f837ea9b42559d88cd3e0ac2fa5c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit b31d90291314c0664ef5aae72225c213fc560b06)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-14 17:53:59 +00:00
Mårten Nordheim
c2be8b3516 tst_QNetworkreply: fix a path to test-data
For some reason it fails on Ubuntu 22.04, but it's anyway
not following the trend the rest of the file uses, so just
assume it's the code at fault and fix it.

Thanks to Liang Qi for debugging this!

Fixes: QTBUG-106016
Change-Id: I9d0563a081827eaa037d61643f0ea46301e11493
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 9e12ea37ea1a62fe5f5ed6860a48928664e19713)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-13 16:00:53 +00:00
Mårten Nordheim
98ef806830 QNetworkReply: Fix missing final emission of readyRead
If we receive compressed data we will decompress it as it comes in,
in some cases the final byte we receive doesn't actually contribute
to the final output. If this byte is handled by itself then, when
combined with QNetworkReply's signal compression, we ended up not
emitting the readyRead signal for any of the data we received while
compressing the signals.

So, instead of relying on checking difference in bytes downloaded
for each batch of data received we keep track of how much data
we had received the last time we emitted readyRead.

Fixes: QTBUG-106354
Change-Id: I4777be29b46bf0de968667e9de9d975c735ac6e6
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 5387b88aa96d2096a3423190d1f1e5bdd2c52052)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-12 17:24:50 +00:00
Mårten Nordheim
03c7222add Make tst_qnetworkreply depend on the 'echo' helper
Because it's convenient to have it build automatically.

Change-Id: Iecd5bd1f9fe518f683b8ee9eb6529e48ce76fb33
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit c288733541b7842f0aa91dba378a00e6c158fa6e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-11 23:20:29 +00:00
Timur Pocheptsov
1a65c64b59 tst_QSslSocket::serverCipherPreferencies - fix for OpenSSL v3
Test was not really good to start with - it was assuming the presence of
particular ciphersuites. Furthermore, it was ignoring the fact that
TLS 1.2 and TLS 1.3 set ciphersuites differently in OpenSSL.

Task-number: QTBUG-106018
Task-number: QTBUG-95123
Change-Id: I6c8ba20154cdeb9275878462ab945729d6c82ecc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 17e8f322ebca42275d23b7a54b9f4161fc851c2b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-08 19:52:29 +00:00
Edward Welbourne
dd98e36201 Work round macOS's omission of en_DE from its own uiLanguages()
When the system locale is en_DE, macOS seems to think we should use
en_GB as the right translation. While that probably is a sensible
choice in the absence of an en_DE translation, we should definitely
use the en_DE translation if available, especially if en_GB isn't
available (which lead to a fall-back to de_DE, given later entries in
macOS's list). So prepend the system locale's own pcp47Name() if it
(isn't the C locale and) is missing from what we would otherwise have
used for uiLanguages(), after likely sub-tag perturbations.

Add a test simulating (some approximation to) what macOS was doing
that would have caught this case; and add a scope-guard reporter to
the test to report what shows up when lists don't match.

Fixes: QTBUG-104930
Change-Id: I116234708067e1717d9157aebc84da76e04a9f38
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 753bfdf6a1336cc296e5fc8175aedd000c2cc013)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-07 15:53:25 +00:00
Mårten Nordheim
63788de25b tst_qlocale: only restore the fp control masks we change
Certain masks are not supported outside 32-bit x86, and will assert on
x64.

Fixes: QTBUG-106000
Change-Id: Ic9f58e5a19c1db3309edeb5ec529e7a78c929665
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 070446d5ebf2a82531160268fbae0bb7c6730ecd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-07 13:17:36 +00:00
Mårten Nordheim
b75504ab81 tst_QSsSocket: fix verifyClientCertificate with OpenSSL 3
OpenSSL 3 by default disables TLS < 1.2 in the conf files. We're not
going to work against that, so we bump the version of TLS used.
Keep the client-side TLS 1.0 Or Later just to keep testing that this
part works.

Task-number: QTBUG-95123
Task-number: QTBUG-106018
Change-Id: Ia6cb10495875de232d69a886832ae74c5f5ac15f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit b4a5f0c57cd9d14dc5a8e825aad6cc329dae1b23)
2022-09-07 13:17:35 +00:00
Mårten Nordheim
acaa3c6a33 QTextStream: Fix logical error in setEncoding
We only want to enable writing BOM if we have _not_ started
writing.

Fixes: QTBUG-106279
Change-Id: Ibcbc101b931615fddb2507f01307bf9619772d7b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c76f7cbbcbe68bf785e8d8cbbe641cd6c0e42834)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-06 23:09:42 +00:00
Tang Haixiang
b3bb20b8bc QTextDocumentLayout: Account for topMargin when hit-testing
When TopMargin is set in TextBlock and the mouse click position is
between Margin (the mouse is not on the textrect), the cursor will
usually jump to the end. So topMargin should be considered when
hitTest() calculates coordinates.

Fixes: QTBUG-91774
Change-Id: I231377263855b9cd7152684203fc4ed2e9299bb9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tang Haixiang <tanghaixiang@uniontech.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 8aae49019d7386c1abd6cd32f7ccb68c264c0288)
2022-09-06 18:26:59 +00:00
Timur Pocheptsov
85d28ea391 tst_QSslSocket::oldErrorsOnSocketReuse - make it work with OpenSSL v3
The initial problem was in server not starting encryption, because
its certificate was rejected by OpenSSL (v3) saying 'weak md'.
After the certificate was replaced, we got another problem - due
to the fixed TLS v.1 protocol for both client and server - handshake
is interrupted early with 'tls v1 alert' and error message
saying about not found signature algorithms. Don't fix the protocol
version, use proper QSsl::SecureProtocols (default).

Task-number: QTBUG-106018
Task-number: QTBUG-95123
Change-Id: I0f22f5304f4405933ad511195bc61c640518e7d8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a7657d3c5ff1aafe347209dc6b76bd6d127694d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-05 10:49:18 +00:00
Mårten Nordheim
bf958e22ce tst_QSslSocket: regenerate certificate used for setLocalCertificateChain
The certificate was using SHA-1 for signing its certificate, which is
considered 'not good enough' by some TLS libraries.
Regenerate it with SHA-512 and a larger RSA key.

Also include the files needed to generate it.

Task-number: QTBUG-106018
Task-number: QTBUG-95123
Change-Id: I535e047d540e663c8cec334695196044173949fc
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 28693abb6490734aac9018dd7d96d429ddba9b7e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-03 09:33:41 +00:00
Timur Pocheptsov
11ac2ccaef tst_QSslSocket::protocolServerSide - make it work with OpenSSL v3
OpenSSL v3 by default sets SECLEVEL = 2 unless overridden in conf files.
SECLEVEL >= 1 means TLS <= 1.1 is disabled. Remove cases that were
previously expected to work. Arguably, we should not test deprecated
protocols at all, but the cases expecting a failure still work
and logically correct.

Task-number: QTBUG-95123
Task-number: QTBUG-106018
Change-Id: Ifa59fa902b433338dbed7abf086cfdef9470384c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d2544b3bb274bb31e89d42b71d4ca64c4e46c126)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-02 19:02:37 +00:00
Shawn Rutledge
70ae87a51c Use testlib for multiPointRawEventTranslationOnTouchScreen events
It was an old test written in a very low-level way, which perhaps is ok
to be independent of testlib in a few tests; OTOH, it was blacklisted
on a couple of platforms. Perhaps doing touch events the standard way
could be more stable.

While we're at it:
- verify that the touch events are accepted, and thus verify the new
  bool return value from commit()
- implement paintEvent() to help understand the layout, and touchpoint
  locations
- remove repeated QCOMPARE lines
- skip the test if window positioning fails
- try to un-blacklist it, on the assumption that window positioning
  failure was the reason

Task-number: QTBUG-87025
Task-number: QTBUG-104656
Change-Id: Ie22eb24abf95cd849990a56212be87d06ce8e574
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit ef9b51ce99fb05a37888f6e2cec733df7ca53144)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-02 17:07:31 +00:00
Eirik Aavitsland
d076c31bfa QVariant: fix conversions of Q_ENUM that are QFlags<> to string
The doc of QMetaEnum::valueToKey() says to use ::valueToKeys() instead
for flag types.

Change-Id: I48e5ba47324137f2ce2710f1d876e93e7c562e9f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 54aa7e75b89d5d27e59594ce35206089ccc22d3b)
2022-09-02 13:13:34 +00:00
Thiago Macieira
2932130a8e QVariant: fix conversions of string keys to Q_ENUM that are QFlags<>
Since Qt 6.0, QMetaType stores the name obtained from the C++ compiler,
which means we know a type like Qt::Alignment by its proper, full name
of QFlags<Qt::AlignmentFlag>. However, the meta object records only the
bare name of the enumeration, not the full flags.

Fixes: QTBUG-105932
Fixes: QTBUG-96185
Change-Id: Ic6547f8247454b47baa8fffd170eab977e306377
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 98e21f0979143a1e278572390012f021dfed1b6a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 19:51:39 +00:00
Timur Pocheptsov
cb61bea591 tst_QSslKey - make OpenSSL v3 detection fully runtime
Otherwise, checks are useles in non-developer build.

Fixes: QTBUG-106036
Change-Id: I41b6d8f250021ff9fa4981f9df9244c269ed2999
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8e21844683d46e777db3db74df0bcf76cb9a35c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 18:10:12 +00:00
Heikki Halmet
c51eb3dfc3 Blacklist: tst_QGraphicsAnchorLayout::layoutDirection for Ubuntu 22.04
Task-number: QTBUG-87728
Change-Id: Ic78a17146c265ffe6baf6f08a0f9c29750bd0d58
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 191419e98040d7aa7c306d3ec2776d5c143d8c2d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-09-01 10:06:20 +00:00
Timur Pocheptsov
9010a4351f QSslCertificate::toText(): add a file to compare against
With OpenSSL 3.0.5 we see X509_print giving us the text representation
not matching any of previous ones - mostly a question of spaces
and formatting. Let's add a proper version to compare against and
remove useless 0.9.8, 1.0.0, 1.0.1, - we don't support them anymore
and thus QSslCertificate::toText() will never give a match.

Task-number: QTBUG-106017
Change-Id: Ida11321c23e74c7313acc682237ab78408cf2803
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 0f2397f03d6dc84ed1157e5a78c3298a1cdd7c85)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 21:33:01 +00:00
Timur Pocheptsov
277b44ab6d tst_QSslCertificate::pkcs12 - skip the test if OpenSSL version >= 3
leaf.p12 is using RC2 for encryption and it's disabled by default
in openssl v3.

Fixes: QTBUG-106017
Change-Id: I4edd0d29506d1e50b2b618b6a00cceeb4b156204
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 0206eb137fcf3239b8657a80a136f6dba77752da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 21:33:01 +00:00
Thiago Macieira
347c9e2b58 RCC: fix zlib compression when --no-zstd was specified
Since we had code to default to zstd as the default algorithm instead of
"Best", we ended up not compressing anything.

[ChangeLog][rcc] Fixed a bug that caused rcc not to compress files with
any compression algorithm if the --no-zstd option was present.

Fixes: QTBUG-106012
Change-Id: Ic6547f8247454b47baa8fffd170fddae429f82d2
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit f12321288009119552df10df75c77228f6bac0db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 21:33:00 +00:00
Timur Pocheptsov
d0745dfe88 tst_QDtls::verifyClientCertficiate - update certs for OpenSSL v3
Because this version does not seem to like MD5 which old cert was using.

Fixes: QTBUG-106019
Change-Id: Id354d1e32acb0528685b2788ee9c7326c43397bd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 267d923ed9329b465b3bb0d2e82c5d07bc83961c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 11:43:52 +00:00
Michael Weghorn
53783496f6 a11y: Don't reassign unique ID to other object right away
For the case that a newly created and registered accessible
interface gets removed again from the cache before another one
gets registered, the next registered interface was
previously assigned the same "unique ID" again, which e.g. breaks
assistive technology when using caching
with AT-SPI, since that relies on the assumption
that the ID is actually unique for each object.
(But here, the new object was using the same object path
as the old one, so data from the old object would be
used for the new one.)

To prevent that from happening, increment the
counter for the next ID to try at the end of
QAccessibleCache::acquireId, so the next time
the method gets called, it doesn't try again
whether the same ID as used previously is
available again.

For consistency, also rename the variable used
for the counter from lastUsedId to nextId.

This also adds a corresponding test case.

Fixes: QTBUG-105962
Change-Id: Iddf4f3b35c57895bcfbb623a5377edf8344ab6c2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8b947bae72bf661d31372d1bb5e3a16db50fca08)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 05:54:54 +00:00
Timur Pocheptsov
9fd40c04d1 QHttp2Configuration: in QNAM, use old, higher values in flow control
Initially, stream receive window's size was quite significant.
At some point when dealing with a server that did not want
our windows' sizes and was closing the connection (they only
accept 64K) we reduced this size, which ended in a regression
with download speed significantly throttled. We return the old
values (or even more, presuming we have 10 multiplexed streams
and not 100). And also making QNAM consistent with its documentation
(it was not updated).

[ChangeLog][QtNetwork] Stream receive window that HTTP/2 protocol in QNAM is using
increased to 214748364 octets (from the previous 64K) not to throttle download
speed. Clients, working with servers, not accepting such parameters,
must set HTTP/2 configuration on their requests accordingly.

Fixes: QTBUG-105043
Change-Id: I252b6b5eefe92a7304dad15c67928d5a57d9597f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 9540a4eb9071a17446c6b68e086bbea2b50d50f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-31 03:28:12 +00:00
Thiago Macieira
8226ae9ac7 tst_QMap: avoid tripping MSVC debug-mode iterator assertions
It does a check to ensure you aren't comparing outside the container.

Fixes: QTBUG-106001
Change-Id: Ic6547f8247454b47baa8fffd170eef346b7f4f24
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit f039147165049dedcf6e1d92d902af28f566d753)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-28 16:41:42 +00:00
Michael Weghorn
e3de89533b a11y: Prevent one case of losing a11y interface when setting event child
9a369a25ddfac9352cabde65c8476c7433dc6c3a added a
QAccessibleEvent ctor that takes a QAccessibleInterface*
instead of a QObject*.

Retrieving the QAccessibleInterface* later is done using the
interface's unique ID stored in the m_uniqueId member.

However, the fact that m_uniqueId is a member
of the union alongside with m_child means that setting
a child via QAccessibleEvent::setChild also overwrites
the stored unique ID, which breaks retrieving the accessible
interface later.

Fix this for the case where the QAccessibleInterface has
an associated QObject by assigning m_object in the ctor as well.
This means that a QAccessibleEvent created using either of the two
constructors (the one taking the QObject* and the one taking
the QAccessibleInterface* associated with the object) now behaves
the same.

Fixing the case where there is no associated QObject would require
further changes (e.g. adding a member for the QAccessibleInterface*
or making the m_uniqueId member a separate member instead of having
it in a union with m_child). However, I see no way to do so without
breaking the ABI, so that is left unchanged.

This also adds a corresponding test case.

Fixes: QTBUG-105988
Change-Id: I71a548af0277a5034e9e207f066fa3e25c5393f3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 0c0eadc484ab7143801593ccdbe8e96eeb9f6cf7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-27 06:11:54 +00:00
Axel Spoerl
c76b524206 Replace logging category lcQpaDockWidgets in dock widget auto test
Logging category lcQpaDockWidgets was used in both dock widget test
and implementation. This dual use caused static builds to fail.

This patch replaces lcQpaDockWidgets with a test specific logging
category in tst_QDockWidget.

Change-Id: I02cdfdaee9c1c1840126d803139b3d271aeac236
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b48364d49b46c5233d761616a573c010824bcb2b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-26 20:27:59 +00:00
Marc Mutz
50d1f6f2cc tst_QDir_10000: add sorted_byName benchmark
Change-Id: Ic30a6353c356f6613f2ef3720b99ebb3b0a7968e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 24675d1a94461cc9d83760c81c164ff4fc0069c9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-26 19:02:26 +00:00
Axel Spoerl
d2e88bc4ea Add QDockWidget save & restore auto test
Implement auto test for (de)serialization of dock widget properties.
Test settings compatibility by importing a hard coded byte array.
Test serialization format and sequence by comparing expected and real
serialization output.
Test dock widget closing behavior (QTBUG-103474) to ensure that
no closing inconsistency is caused by serialization incompatibility.
Extensively document/comment the test to ensure failures can be easily
interpreted in the future.

Task-number: QTBUG-103474
Change-Id: I3c1589c2c291b2ed56334d09b85536d4c7388f92
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0c54ac20eb27afb9271f5cc8bdb39926796c0896)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-26 19:02:26 +00:00
Volker Hilsheimer
6dd2dbaef6 QAbstractItemDelegate: tolerate that editor gets reparented
An item delegate might override destroyEditor to merely reparent the
existing editor out of the item view for later reuse, rather than
actually destroying the editor.

As of d0dffdfc012574da4a75241097b667d09bb39ba2, the code calling
closeEditor() - which calls destroyEditor - might explicitly set focus
back to the item view parent of the editor. This needs to handle that
the parent of the editor might no longer be valid after the closeEditor
call returns, and rather store the old parent widget explicitly.

Add a test case that segfaults with nullptr access without the fix.

Fixes: QTBUG-105231
Change-Id: I04a355673823c4941865f7a575864e991ceeb5f0
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 52f4d0b0d2a29a08e55293664bf1c8002cad0d17)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-25 16:04:30 +00:00
Eskil Abrahamsen Blomfeldt
a20d257015 Wayland: Skip test that queries window position
The client does not know its global window position on Wayland,
so testing for this will not work.

Fixes: QTBUG-100888
Change-Id: Ibdfc84f1b33d25223dbd740603ce4783c21afc70
Reviewed-by: Inho Lee <inho.lee@qt.io>
(cherry picked from commit e8031906b596fb58d4426fc1ea2c93d3fcb0d77d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-25 16:04:29 +00:00
Ivan Solovev
b58fcc10bd tst_qshortcut: port away from deprecated APIs
Explicitly call QKeycombination::toCombined() instead of deprecated
implicit operator int().

Task-number: QTBUG-104858
Change-Id: I46b0863eda445e832a9490bc2a3d05811c2df8c6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e5c184ecd11ab1f03ee568687fbfd25d1c2dd8d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-25 07:58:02 +00:00
Morten Sørvig
c55ce84808 wasm: add echo_server test TCP server
Test server for in-browser TCP usage.

Change-Id: Ia1a29c0e14a6d2ee8075ce202c9f6998a3ccc4c9
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit a2d0ce32cdfffd3fff1be9c0d6663e11bb01419d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-24 19:12:11 +00:00
Axel Spoerl
3638a46b67 Make QHeaderView restore state from different stream versions
If restoring a QHeaderView state from a data stream with version Qt_5_0,
check alignment and resize mode properites for out-of-bound values.

If out of bounds, try QDataStream version Qt_6_0, which is used by KDE
apps compiled with 5.15.2 or 6.2.3.

QFileDialog stores settings in the same settings file across different
Qt versions, using different QDataStream versions. That makes
QFileDialog vulnerable to the issue (QTBUG-104962). A respective auto
test is added with this patch.

Fixes: QTBUG-104962
Task-number: QTBUG-104425
Change-Id: I666207fca7ab837ad27a247e504a40757ee8afab
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 854cb55987b3de3c8379db0e7e95b4c94d4e6588)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-24 17:11:23 +00:00
Tor Arne Vestbø
0ac44dd870 tst_qgraphicswidget: Avoid redeclaration of Size from MacTypes.h
If an included header brings in MacTypes.h it will cause issues,
so rename the enum to be on the safe side.

Change-Id: I29ec795be74a65d4f2267d8121a514bf192cf969
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1ecfc4101cf41b1d3947ed938bb76c52919f360b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-22 00:22:11 +00:00
Marc Mutz
96fea6e142 tst_qbytearray: remove qCompress_data for QT_NO_COMPRESS
The _data function is useless without its test function (and it's not
used in other _data functions).

Change-Id: I7aa6006ed1a9d89008577b750af4ea717dae237f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit b5d5385201e74c216c69aff78c383738e801a839)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-21 20:23:19 +00:00
Volker Hilsheimer
77a892affc Don't access QObjectPrivate::declarativeData unguarded
The QObjectPrivate::declarativeData member is stored in a union with
currentChildBeingDeleted. The QObject destructor always sets the
currentChildBeingDeleted member of the union. It also sets the
isDeletingChildren bool, which is the only way to find out which union
member we can safely access.

While the QObject destructor is deleting children and isDeletingChildren
is set, we must not access the declarativeData member of the union.

Add a test case that initializes the function pointers for the
declarative handlers and constructs a situation where an object
emits a signal while it is destroying children.

Fixes: QTBUG-105286
Change-Id: Iea5ba2f7843b6926a8d157be166e6044d98d6c02
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 3be99799a675a631c67e05897383af9abbc377b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2022-08-21 02:36:51 +00:00