Commit Graph

64071 Commits

Author SHA1 Message Date
Volker Hilsheimer
ed2fbed479 JNI: emit warning in debug mode in case of JNI environment conflicts
If a QJniObject method that uses the stored JNIEnv pointer is called
from a different thread than the one the object was created in, then a
FATAL abort of the JNI runtime is likely, but hard to debug (the error
messages from JNI are visible in the logcat log of adb).

In debug mode, compare the stored JNIEnv pointer with the one provided
for the current thread, and emit a critical runtime warning if they do
not match, as this indicates a race condition to the underlying JAVA
object.

Change-Id: Ief578f445bcfab1939ddbe95c6ba796279be9115
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-10-18 15:02:23 +02:00
Volker Hilsheimer
944200b5a9 JNI: Reduce amount of temporary QJniEnvironment instantiations
Almost all operations on a QJniObject require a QJniEnvironment,
including the construction and destruction of a QJniObject. Instead of
instantiating a temporary QJniEnvironment object in each call, store the
one from the constructor in the private, and reuse it.

Pass the stored environment through to other functions needing it, and
add a checkAndClearExceptions() wrapper.

Static class members still need their own QJniEnvironment, but we can
reuse the one we have to get both jclass and jmethodID rather than
creating new QJniEnvironments in several wrappers.

As a drive-by, clean up nullptr usage in the test that failed when
shortcutting isSameObject for the trivial cases.

Change-Id: Ibadbd2be8a0ec9ab62daf285608ee7fe0a3c8852
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-10-18 15:02:22 +02:00
Volker Hilsheimer
b7a7351767 JNI: treat equivalent C++ types as the same JNI types as well
Our signature mapping treats both e.g. bool and jboolean as "Z", and it
is allowed to pass a bool variable as an argument to a function expecting
a jboolean. Except for fields and callMethod return values, where we only
allowed the JNI primitive types.

Fix this by comparing the signatures and size of the type we have with
the JNI types that there are explicit functions for. Cast from and to
the JNI type in both directions to address narrowing (e.g. jboolean is an
unsigned char and converting to bool would be narrowing, even though
both are 8bit types).

This way we can get boolean fields using getField<bool>, and int fields
using getField<int> etc.

Change-Id: I2f1ba855ee01423e79ba999dfb9d86f4b98b1402
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-10-18 15:02:22 +02:00
Volker Hilsheimer
872f7b0b4e JNI: convert to and from JNI types for callObjectMethod as well
While we can probably deprecate this function, with the change of
Q_DECLARE_JNI_CLASS'ed types to be QJniObjects we need to correctly
translate from e.g. jobject to QJniObject.

Amends 62cb5589b3.

Change-Id: Id3c23fc0724e2eff895029b694d418481abcb8e6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
2023-10-18 15:02:22 +02:00
Mikolaj Boc
322e2a2821 Simplify QWasmIDBSettingsPrivate
Since QWasmIDBSettingsPrivate is only supported on JSPI now, there is
no need to maintain the isReadReady flag anymore. This lets us simplify
the class a lot.

Change-Id: I67322389463af13b5110091a4f8433f08da19925
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-10-18 15:02:22 +02:00
Marc Mutz
381d6210c2 qevent.h: don't include <QPointer>, fwd-declare it
The header uses QPointer in-name-only, so it doesn't need to include
the class' header file. A forward-declaration suffices.

[ChangeLog][Potentially Source-Incompatible Changes] The headers
qevent.h and qfuture.h no longer include the header qpointer.h.

Change-Id: I8d3c3b56f5928a0745a523abf5df3b8106dc15ee
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-10-18 14:41:33 +02:00
Kai Köhne
3aa6f0b396 CMake: Use stored compiler only for qt-cmake-private
Change the heuristic only to use the stored compiler if we
are  building qt itself, like with qt-cmake-private
/ qt-configure-module. qt-cmake is also used by end-users,
where the heuristic to change the compiler default base on
paths is surprising, and can go wrong.

Fixes: QTBUG-108323
Pick-to: 6.6
Change-Id: I0274e470f214a84711013d77068551f9097f4685
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-10-18 14:41:33 +02:00
Amir Masoud Abdol
885d87488a Make sure that pkgconf can find HarfBuzz
pkgconf is an alternative implementation of pkg-config, and it is mostly
compatible with pkg-config, but in the case of HarfBuzz, it adds the
`/usr/local/include` to `INTERFACE_INCLUDE_DIRECTORIES` when reports the
include path, and if the path doesn't exist, the configuration fails.

In the case of HarfBuzz, we do some extra work to make sure that we can
always find the library, so, with a bit of modification, we can skip the
faulty pkgconf intervention and create the correct imported target.

Fixes: QTBUG-117905
Change-Id: Id628e4434633534b0d7bfad9e819a8c05da4944d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-10-18 10:08:27 +02:00
Christian Ehrlicher
7398645292 QCommonStyle: misc cleanup
Simplify addIconFiles() by passing an initializer list instead an
c-array + size

Task-number: QTBUG-118122
Change-Id: Id54bbe8436a9106e59b6fede81e31c3065623b4d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-18 06:16:22 +02:00
Christian Ehrlicher
f2c2242c74 SQLite: Update SQLite to v3.43.2
[ChangeLog][Third-Party Code] Updated SQLite to v3.43.2

Pick-to: 5.15 6.2 6.5 6.6
Change-Id: I50ab6d53ada764e1d9390e4d768f4abf0de5652f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-18 06:16:20 +02:00
JiDe Zhang
518c98cea4 Remove unnecessary code in QCursor
Dont't checks before call QCursorData::initialize().
The inside of QCursorData::initialize() already checks initialized.

Change-Id: I4b34218132df9decf7d04dcc31e873daf300ffe6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-18 04:15:03 +00:00
Thiago Macieira
c94bed69b7 moveToTrash/Unix: refactor to use openat()/mkdirat()/renameat()
This ensures much better security against race conditions and attacks,
at the expense of a few more system calls.

On first run (when no trash dir is yet present):

  openat(AT_FDCWD, "/home/tjmaciei/.qttest/share/Trash", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
  mkdirat(AT_FDCWD, "/home/tjmaciei/.qttest/share/Trash", 0700) = 0
  openat(AT_FDCWD, "/home/tjmaciei/.qttest/share/Trash", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = 5
  newfstatat(5, "", {st_mode=S_IFDIR|0700, st_size=0, ...}, AT_EMPTY_PATH) = 0
  getuid()                                = 1000
  openat(5, "files", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
  mkdirat(5, "files", 0700)               = 0
  openat(5, "files", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = 6
  openat(5, "info", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
  mkdirat(5, "info", 0700)                = 0
  openat(5, "info", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = 7
  close(5)                                = 0
  openat(7, "tst_qfile.moveToTrashOpenFile.fjYRxv.trashinfo", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666) = 5
  openat(AT_FDCWD, "/usr/share/zoneinfo/UTC", O_RDONLY|O_CLOEXEC) = 8
  newfstatat(8, "", {st_mode=S_IFREG|0644, st_size=114, ...}, AT_EMPTY_PATH) = 0
  newfstatat(8, "", {st_mode=S_IFREG|0644, st_size=114, ...}, AT_EMPTY_PATH) = 0
  read(8, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 114
  lseek(8, -60, SEEK_CUR)                 = 54
  read(8, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 60
  close(8)                                = 0
  write(5, "[Trash Info]\nPath=/home/tjmaciei"..., 103) = 103
  renameat(AT_FDCWD, "/home/tjmaciei/tst_qfile.moveToTrashOpenFile.fjYRxv", 6, "tst_qfile.moveToTrashOpenFile.fjYRxv") = 0
  close(5)                                = 0
  close(6)                                = 0
  close(7)                                = 0

On subsequent runs:

  openat(AT_FDCWD, "/home/tjmaciei/.qttest/share/Trash", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = 5
  newfstatat(5, "", {st_mode=S_IFDIR|0700, st_size=18, ...}, AT_EMPTY_PATH) = 0
  getuid()                                = 1000
  openat(5, "files", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = 6
  openat(5, "info", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_DIRECTORY) = 7
  close(5)                                = 0
  openat(7, "tst_qfile.moveToTrashOpenFile.sPjrcA.trashinfo", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666) = 5
  openat(AT_FDCWD, "/usr/share/zoneinfo/UTC", O_RDONLY|O_CLOEXEC) = 8
  newfstatat(8, "", {st_mode=S_IFREG|0644, st_size=114, ...}, AT_EMPTY_PATH) = 0
  newfstatat(8, "", {st_mode=S_IFREG|0644, st_size=114, ...}, AT_EMPTY_PATH) = 0
  read(8, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 114
  lseek(8, -60, SEEK_CUR)                 = 54
  read(8, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 60
  close(8)                                = 0
  write(5, "[Trash Info]\nPath=/home/tjmaciei"..., 103) = 103
  renameat(AT_FDCWD, "/home/tjmaciei/tst_qfile.moveToTrashOpenFile.sPjrcA", 6, "tst_qfile.moveToTrashOpenFile.sPjrcA") = 0
  close(5)                                = 0
  close(6)                                = 0
  close(7)                                = 0

Change-Id: I9d43e5b91eb142d6945cfffd1787117927650dab
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-10-17 19:08:25 -07:00
Thiago Macieira
25b1990784 moveToTrash/Unix: use the file's inode number as collision avoidance
Instead of a sequential and thus predictable counter. This improves the
performance of when you keep creating and trashing the same file base
name. The previous algorithm would try all occurrences from 0 to however
many trashings have happened.

This could have been any random number, but the source file's inode is
"random" enough for us.

strace of the second file's trashing:

openat(AT_FDCWD, "/home/tjmaciei/.qttest/share/Trash/info/tst_qfile.moveToTrashOpenFile.vLwfNe.trashinfo", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666) = -1 EEXIST (File exists)
newfstatat(AT_FDCWD, "/home/tjmaciei/tst_qfile.moveToTrashOpenFile.vLwfNe", {st_mode=S_IFREG|0644, st_size=16, ...}, 0) = 0
openat(AT_FDCWD, "/home/tjmaciei/.qttest/share/Trash/info/tst_qfile.moveToTrashOpenFile.vLwfNe-23527891.trashinfo", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666) = 4
newfstatat(AT_FDCWD, "/etc/localtime", {st_mode=S_IFREG|0644, st_size=2852, ...}, 0) = 0
write(4, "[Trash Info]\nPath=/home/tjmaciei"..., 103) = 103
renameat2(AT_FDCWD, "/home/tjmaciei/tst_qfile.moveToTrashOpenFile.vLwfNe", AT_FDCWD, "/home/tjmaciei/.qttest/share/Trash/files/tst_qfile.moveToTrashOpenFile.vLwfNe-23527891", RENAME_NOREPLACE) = 0
close(4)                                = 0

Change-Id: I9d43e5b91eb142d6945cfffd1786d73459c2eb3d
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-17 19:08:25 -07:00
Thiago Macieira
77c661b275 moveToTrash/Unix: use lower-level API to write the info file
So we can more easily get any errors from attempting to write the file.
It is possible to get them with QFile, by either doing .flush() or using
QIODevice::Unbuffered, but using the C API is a definite sure way. Plus,
since this is QFileSystemEngine, this avoids the possibility that QFile
may choose to use a different file engine than the native one, for some
reason. And it reduces overhead.

This allows us to more easily detect why the file creation failed and
therefore stop looping if the error wasn't EEXIST. That will avoid an
infinite loop in case the necessary directories exist but aren't
writable.

It's also moved above the renaming, such that the failure to populate
the info file prevents the renaming too. Both operations can have the
same likely errors, ENOSPC and EIO. The likelihood of EIO is very low,
for both; but for ENOSPC it's far more likely for writing the
file. Avoiding the ENOSPC error for the renaming is handled in a later
commit.

Change-Id: I9d43e5b91eb142d6945cfffd1786d417142ac728
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-10-17 19:08:25 -07:00
Thiago Macieira
6359e8b8bd moveToTrash/Unix: avoid creating too many QStorageInfo
QStorageInfo is great, but rather expensive, so this introduces a faster
check by stat()ing the source file and $HOME, to see if they are the
same device, saving us two or three QStorageInfo constructions. That is
a necessary condition: if they aren't the same device, we know rename()
into $HOME/.local/share/Trash will fail.

But it's not a sufficient condition: they need to be the same mount
point and that's something only QStorageInfo will give us. Strictly
speaking, the only way to be sure that you can rename() into the trash
path is to, well, attempt it (as usual, something for a later commit).

Change-Id: I9d43e5b91eb142d6945cfffd1786c474cac25083
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-10-17 19:08:25 -07:00
Thiago Macieira
de24134aa7 moveToTrash/Unix: avoid TOCTOU in creating the unique file name
This is not a security issue because we still use QIODevice::NewOnly
(O_EXCL) and loop again. But because we do so, we don't need to check
for existence with QFile::exists() in the first place.

Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786c98a39781517
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-10-17 19:08:25 -07:00
Thiago Macieira
1c5575f194 moveToTrash/Unix: trust freeDesktopTrashLocation() to find the directory
Make it receive the QSystemError so it can set the error condition
properly in case the suitable location for this input file can't be
found. This also includes the case when the input file does not exist in
the first place, which I moved into the function because upcoming
commits will imply this check anyway.

Change-Id: I9d43e5b91eb142d6945cfffd1786c6e59d3b0204
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-17 19:08:24 -07:00
Ahmad Samir
ba0b4a1dc8 QGraphicsAnchorLayout: remove a redundant member container
The m_children container isn't used at all, so remove it. Spotted by
Volker Hilsheimer.

Change-Id: I79db1f77c0e4caf8ebab1573a82e07396a6a806b
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-10-18 03:05:55 +03:00
Thiago Macieira
dec72d165b QThread/Unix: don't hardcode OSes for PThread cancellation support
Instead, check the macro that we're about to use. This is also done in
qprocess_unix.cpp

Pick-to: 6.5 6.6
Change-Id: I8f3ce163ccc5408cac39fffd178d657b7594d07a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-10-17 23:52:27 +00:00
Ivan Solovev
9e26f1da0b QDateTime: improve docs about invalid vs valid datetime relation
Extract the information about the relation between invalid and valid
datetimes into a snippet, and include it in the documentation of
every relational operator.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I61b239647efe928eb0758cfc5649b33ab4d06c7d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-17 23:34:22 +02:00
Tor Arne Vestbø
8f2828683e Windows: Don't re-apply application badge if one has not been set
We need to re-apply the application badge when the color scheme changes;
when a task bar button is being created for the fist time; or after Explorer
has crashed and re-started.

But we should only do that if the user has set an application badge
via our APIs. Otherwise we might end up clearing an existing badge
that was set via the native APIs directly.

Fixes: QTBUG-118117
Pick-to: 6.5 6.6
Change-Id: I1f1fecba44c118d4e3f7ef4119139c3ebd23f047
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-10-17 23:34:22 +02:00
Tor Arne Vestbø
7152a1d0be Add missing static to constexpr in keyevents test
Change-Id: I9e83876aadca3254042eb48ed51287e403830cf0
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-10-17 23:34:22 +02:00
Wladimir Leuschner
4f51742ee1 Prevent state change of selected LineEdit in QWindowsVistaStyle when hovering
Hovering over a selected LineEdit gives the selected state precedence
over hover state.

Fixes: QTBUG-117606
Pick-to: 6.5 6.6
Change-Id: Ia52ce94443100bf3fb5d83b8dffa2752818ca33d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
2023-10-17 22:44:36 +02:00
Timothée Keller
9a64449cc3 Windows QPA: remove SWP_NOCOPYBITS for plain moves
The SWP_NOCOPYBITS flag helps suppress some jittering during resizes.
At the moment this is called even for plain moves with no window
resizing. Make sure that the window geometry has changed before applying
the SWP_NOCOPYBITS flag

Fixes: QTBUG-115992
Pick-to: 6.6 6.5
Change-Id: Ic0cb32d9eb3b557bf2b2ef5b6ba80d34e27c5c19
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io>
2023-10-17 22:44:36 +02:00
Jonas Kvinge
1eddd7add0 macdeployqt: Fix codesigning with @loader_path
When the -executable parameter is specified, macdeployqt uses
@loader_path instead of @rpath. This case was not handled in
getBinaryDependencies() used for the code signing.

Fixes: QTBUG-118075
Pick-to: 6.6
Change-Id: Ie1e0d0781305e1849df9ec0d5fb1c3ce6713a62b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-17 19:23:42 +00:00
Mate Barany
0345f07dd1 Support body for an HTTP GET request
Add two overloads to QNetworkAccessManager to support GET requests
with body.

Modify QNetworkReplyHttpImpl as well as these requests should not
be cached.

If the request is redirected it is possible that its type changes
from POST/PUT to GET and in this case the message body is deleted.
However, if a GET request has a body it should keep it after it has
been redirected - modify QNetworkReplyHttpImpl to keep the message
body after it has been redirected.

Fixes: QTBUG-112871
Change-Id: Ib01898638ed94238a98291870a5c51d56030868a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2023-10-17 21:23:42 +02:00
Ahmad Samir
1097c21748 QGraphicsAnchorLayout: make a member container const
The m_edges container isn't changed after it's initialized in the
constructor; so make it const.

This amends commit 641bccce2a.

Change-Id: I387eb2562475bc4910700d48f67303b0a5f80ccd
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-10-17 22:23:42 +03:00
Ahmad Samir
408799de65 QCoreApplication: use the correct typedef of preRList
`QVFuncList` and `QStartUpFuncList` are identical typdefs
(`QtCleanUpFunction` and `QtStartUpFunction` are identical typedefs):
typedef QList<QtCleanUpFunction> QVFuncList;
typedef QList<QtStartUpFunction> QStartUpFuncList;

So from the compiler's POV QVFuncList and QStartUpFuncList can be used
interchangeably, but from a code reader's POV, this is confusing.

Use IILE to make the local variable const.

This amends commits 9429226524 and
a887891271.

Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-117242
Change-Id: I67f6af89027fe36a1915e815acd3c9446f7dcd5d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-10-17 19:23:42 +00:00
Milla Pohjanheimo
5ceb78e8d9 Add binary compatibility file for 6.6.0
Task-number: QTBUG-117583
Pick-to: 6.6
Change-Id: I9b63b916a59ddaeb89d2b819b36ee9dc57851dac
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2023-10-17 22:23:42 +03:00
Anton Kudryavtsev
18367d0a11 qmimeglobpattern: port some methods to QSV
It's private API, so it's safe

Change-Id: Ibf35262117c4ce4a1e548fff814a6e7bea362309
Reviewed-by: David Faure <david.faure@kdab.com>
2023-10-17 19:23:42 +00:00
Mårten Nordheim
8111a7d08f QNetworkInfo[NetworkManager]: Fix double-lookup
Change-Id: Ia44993fa229b223cfa40ed6cf922c4d5cfd3042b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-17 21:23:41 +02:00
Mårten Nordheim
14510bac9a Network: Use the new invokeMethod overload
Saves us from having to create a lambda functor object.

Change-Id: I5e790e693b57ae414ac6d6be84f18b76b3e8185c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-17 21:23:41 +02:00
Mårten Nordheim
45a3fa0101 Clean up qnoncontiguousbytedevice.cpp
Mostly applying clang-format and clang-tidy fixits for:
- Redundant code (e.g. bool == true/false)
- Use member initializer list
- std::move for parameters taken by copy

Change-Id: I3b9a7f01db67291f889b42346a95c55ad74f054c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-10-17 21:23:41 +02:00
Mårten Nordheim
3e6b42ae9d compressEvents: limit iteration
Slightly improves performance in the new benchmark

Change-Id: I2d71143ff7bc1f32ebb172f20be1843dec123e6c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-10-17 21:23:41 +02:00
Tor Arne Vestbø
422880c9db macOS: Enable Latin key combinations when Command (⌘) modifier is pressed
When the Command key is pressed AppKit seems to do key equivalent
matching using a Latin/Roman interpretation of the current keyboard
layout.

For example, for a Greek layout, pressing Option+Command+C produces a
key event with chars="ç" and unmodchars="ψ", but AppKit still treats
this as a match for a key equivalent of Option+Command+C.

We can't do the same by just applying the modifiers to our key map,
as that too contains "ψ" for the Option+Command combination. What we
can do instead is take advantage of the fact that the Command modifier
layer in all/most keyboard layouts contains a Latin layer. We then
combine that with the modifiers of the event to produce the resulting
"Latin" key combination.

If the unmodified key is outside of Latin1, we also treat that as a
valid key combination, even if AppKit natively does not. For example,
for a Greek layout, we still want to support Option+Command+ψ as a key
combination, as it's unlikely to clash with the Latin key combination
we added above.

However, if the unmodified key is within Latin1, we skip it, to avoid
these types of conflicts. For example, in the same Greek layout, pressing
the key next to Tab will produce a Latin ';' symbol, but we've already
treated that as 'q', thanks to the Command modifier, so we skip the
potential Command+; key combination. This is also in line with what
AppKit natively does.

Fixes: QTBUG-96371
Fixes: QTBUG-79493
Task-number: QTBUG-112736
Change-Id: I30d678c1c7860642d3eed29c7757133ff74c6521
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-17 18:51:17 +00:00
Tor Arne Vestbø
98889c2ffc macOS: Filter out and prioritise key combinations that produce the same key
An incoming key event with a set of modifiers can potentially match
a range of key combinations, depending on how the event's modifiers
are combined to produce "intermediate" representations of the event.

For example, given a normal US keyboard layout, the virtual key
23 combined with the Alt (⌥) and Shift (⇧) modifiers, can map
to the following key combinations:

  - Alt+Shift+5 (Fully expressed combination)
  - Alt+% (Shift consumed to produce %)
  - Shift+∞ (Alt consumed to produce ∞)
  - fi (Shift and Alt consumed to produce fi)

But in other cases the intermediate modifier combinations
produce the same key/symbol as other modifier combinations.

For example, pressing  Alt (⌥) and Shift (⇧) with the 'c'
key on a US layout will produce:

  - Alt+Shift+C (Fully expressed combination)
  - Shift+Ç (Alt consumed to produce Ç)
  - Ç (Shift and Alt consumed to produce Ç)

In this case, we don't want to reflect the standalone 'Ç',
as that has already been reflected in the more direct form
via Shift+Ç. Consuming the additional Shift modifier does
not produce any additional symbols.

The same can happen without the number of modifiers being
different, in case two modifiers produce the same symbol.
In this case we want to prioritize Command over Option
over Control over Shift.

There is similar logic in the Windows and XKB key mappers,
and the implementation in the Apple key mapper has been
adapted from the Windows key mapper.

Task-number: QTBUG-67200
Task-number: QTBUG-38137
Change-Id: I4f1aeebac78a5393f8da804b53cf588f7c802c1b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-17 20:51:16 +02:00
Alexey Edelev
0392570385 Allow Qt components be OPTIONAL when building standalone tests
We look for all Qt components when attempt configuring standalone
tests. If some 3rdparty dependencies are missing in user environtment
the configuring proccess will fail even if the dependency is not used
by the standalone tests. Avoid requiring the Qt components, so users
will see only warnings about the missing comonents or dependencies.

Fixes: QTBUG-117709
Pick-to: 6.6 6.5
Change-Id: Iecce40449cdf116f1a7c279ebb161f0f5c7f6a9f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-10-17 20:51:16 +02:00
Assam Boudjelthia
a1b28bba9d JNI: fix error float argument to 'va_arg' is promotable
If the native method contains a jfloat parameter, I get
the warning/error:
 Second argument to 'va_arg' is of promotable type 'JNITypeForArg<float>'
(aka 'float'); this va_arg has undefined behavior because arguments will
be promoted to 'double'

Change-Id: I8e8ee256b9bea01585b5f70554ba2fc537e2c94d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-10-17 21:51:16 +03:00
Samuli Piippo
38cc03c9af eglfs: extend configure test for egldevice
Amend 1aba24a2ed and add check for the
EGL_DRM_MASTER_FD_EXT now used as older egl headers might not have it.

Pick-to: 6.6 6.5
Change-Id: I98b860d05396c24b8eb0e73172ac395c89da8628
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Alex Bu <alex.bu@qt.io>
2023-10-17 21:51:16 +03:00
Marc Mutz
5797f29e8c QAtomicScopedValueRollback: fix UB (passing rel/acq_rel to std::atomic::load())
It's explicitly undefined behavior to pass release/acq_rel
memory_order to load(), so don't.

This is private API, so no ChangeLog needed.

Reported-by: Fabian Kosmale <fabian.kosmale@qt.io>
Task-number: QTBUG-115107
Pick-to: 6.6 6.5
Change-Id: Iee119303d790c31937238ef92d900a25020e9713
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-10-17 20:51:16 +02:00
Mårten Nordheim
744e9a69ab SignalDumper: fix UB (data race on ignoreLevel)
... by making it thread_local.

It is written and read by multiple threads at the same time, so it needs
to be protected. Since signal emission start and end happens in a single
thread, keep it thread_local rather than using an atomic.

Pick-to: 6.6 6.5
Change-Id: I98fc5438c512b45f936318be31a6fccbe5b66944
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-10-17 18:51:16 +00:00
Mårten Nordheim
ae0d231c96 SignalDumper: fix UB (data race on indentation level)
... by making it thread_local.

As a natural (and welcome) side-effect, this makes output look sane in
multithreaded scenarios.

As for why it should be thread_local instead of an atomic:
Since signal emissions and slot invocations on one thread are not
necessarily correlated with another thread, they should not affect
one another's indentation level. As in, emitting QIODevice::readyRead
on a background thread should not make QEventLoop::aboutToBlock on the
main thread be indented. The only exception to this is BlockingQueued,
where one thread is directly tied to another (QTBUG-118145). But slot
invocations are anyway not currently printed for Queued connection
(see QTBUG-74099.)

Pick-to: 6.6 6.5
Change-Id: Iea1fc522d37626df14af419a3455a732729edf74
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-17 18:51:16 +00:00
Tasuku Suzuki
6544a23603 CMake: Fix Qt toolchain file recursive inclusion
'.' in the regexp must be escaped.
e.g. "/qt/toolchain.cmake" matches "/qt.toolchain.cmake$"

Pick-to: 6.5 6.6
Change-Id: Ib6b66349e1619908a33b4a11d79f7ba19d0e8fdc
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-10-17 06:31:54 +00:00
Mitch Curtis
ec5383efc3 selftests: document how to run subtests from Windows' cmd.exe
It deoesn't like single quotes, which must be replaced with doubled-up
double quotes.

Pick-to: 6.2 6.5 6.6
Change-Id: I8e5f8047e72e4433926a9f4f2044407a4d823682
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-17 12:26:07 +08:00
Qt CI Bot
53a36f6ce2 Merge integration refs/builds/qtci/dev/1697477118 2023-10-16 20:38:46 +00:00
Edward Welbourne
c78d9bf549 Split VariantOrderedMap out of Converter's header in example
Although used mostly in the same files, they're separate types, so
define them in separate places.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I9e64b382ad48f9a74e432ccd49b6f5fcc9316da3
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-16 22:38:17 +02:00
Edward Welbourne
08ac3ddde7 Remove unused Map alias for VariantOrderedMap in convert example
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Ic82f7961df5f7a5bb0cd6cc113e4019508e58f47
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-16 22:38:17 +02:00
Alexey Edelev
2b6270af24 Add the missing QtGui/qtgui-config.h
QT_NO_OPENGL is defined in qtgui-config.h so we should include it before
checking the definition.

Fixes: QTBUG-115446
Pick-to: 6.5 6.6
Change-Id: I29b9d7d89fe4c079ca0cf767a1b1a63cc5621623
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-10-16 19:53:36 +02:00
Mårten Nordheim
13c4e11c49 http2: When a reply is removed from the queue, only remove one
We were using the .remove(Key) API on the map instead of
erase(iterator), so we were removing any reply of the same priority that
had not yet been popped from the queues.

Rewrote to drop loop and only work with iterators.
This issue was there since SPDY days, so not picking all the way back to
5.15, where HTTP2 anyway is not enabled by default.

As a drive-by, drop the #ifndef QT_NO_SSL, which was also there from
SPDY times, which was TLS-only.

Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-116167
Change-Id: Id7e1eb311e009b86054c1fe3d049c760d711a18a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-16 19:28:26 +02:00
Edward Welbourne
94ade05ca1 Split VariantOrderedMap out of Converter's header in example
Although used mostly in the same files, they're separate types, so
define them in separate places.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I9e64b382ad48f9a74e432ccd49b6f5fcc9316da3
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-10-16 19:00:51 +02:00