Commit Graph

68187 Commits (fbef250c6c4eb00fa69fb8d100db9dea01057b38)

Author SHA1 Message Date
Marc Mutz fbef250c6c Fix (unlikely) truncation in write_xbm_image()
The usual qsizetype -> int problem. Fix by using auto.

Change-Id: Ie990dec39c8c33cdc055da6bfee451319825c934
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 0cef4ae6870fdd57fd908cdecde3c6c426b7321e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 23:06:53 +00:00
Igor Khanin d84105e71f Fixup QTextOption enum formatting
Add missing trailing space, and change to newer "since Qt version"
format for relevant enum values.

Pick-to: 6.7 6.5
Change-Id: Iffe959545d9d608a65c41c8d3ad56f16468cfa73
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit f7d1d5cb0110552c276ff7a4d8bfb79bf1129c87)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 23:06:49 +00:00
Marc Mutz 334a83e4a7 Fix potential truncation in write_xbm_image()
The old code sized the buffer according to the UTF-16 size of the
input, but in fact wrote UTF-8 output, which can be up to twice as
large as UTF-16, overflowing the buffer size. Not a buffer overflow,
because qs_n_printf(), but truncation would create an invalid XBM
file here.

Fix by converting to UTF-8 first (and only once), and taking the
buffer size from there.

Introduced by 2883a6de40, which replaced
toAscii() (whose result has the same size as the input) with toUtf8()
(which can be larger).

Pick-to: 6.7 6.5
Change-Id: I4acc0816a94060520695c3e6895ed982812fdee2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6d3bd0ebeacc76178fc3c4c368e04bd642881a96)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 15:01:31 +00:00
Marc Mutz c8771a3082 QDebug: make Stream ctors explicit
Their argument types are not faithful representations of a Stream
object, so ctors should not be implicit. Besides, the QDebug ctors
that delegate to these Stream ctors are explicit, too, with the same
arguments.

Change-Id: I8048e26e890009cc8f6bc3ce49e2c01af1e89514
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a9ab406a69f4edc4228cc2effbcde309fcdcf411)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 15:01:31 +00:00
Marc Mutz 0471e845e4 qtesttostring.h: don't write 32..256B of NULs
qsnprint() is unconditionally called to fill the buffer and is
guaranteed to NUL-terminate, so there's no point in filling the whole
stack buffer with NULs beforehand. Leave it uninitialized.

The code was moved in 4ae6f40b3a, so not
picking further than that.

Change-Id: I34d456ebd2990aa242ccc42693adbbf1f64148de
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4c5b437a3ce84354dfa3bf2c4706e05144ac03a3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 15:01:31 +00:00
Marc Mutz ae515c3f2e Fix signature of QDebug::toString() (again)
There are zero QDebug operators that take an rvalue RHS, so there's no
need to make toString() perfectly forwarding. It just causes four¹
different versions of the identical function to be instantiated. Not
all compilers can merge the binary representations and those that try,
violate the standard (same address for different functions).

¹ {rvalue, lvalue} × {const, non-const}

Fix by taking by cref.

Amends 4097653215.

[ChangeLog][Potentially Source-Incompatible Changes][QtCore][QDebug]
The toString() static function no longer allows the called
operator<<() to modify the argument. No Qt-provided operator<<() does
that, and operators that do are probably buggy.

Change-Id: Iac1ee9d29f93fd4840b75ffe363d354a2d19a96e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 13244eef6c913bb7f27cd8fbf459f5dfe9a0ed21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 15:01:31 +00:00
David Faure f7eddcdcb1 QTextDocument: repair AlignBaseline for inline objects
The code from QTBUG-14414 (Qt4 commit
ee9455ed2a83084692d969c398ecb91bcd4fc33a) was removed in commit
199f9c5448, due to an oversight: that
commit was only about images, while there's also the case of inline
objects that contain actual text. Such objects are easy to overlook
because they are not provided by Qt itself. They are however common
in applications that implement word-processor-looking "variables",
like a place-holder for "page number", for instance).

Pick-to: 6.7
Change-Id: I2ff1476583bdfe24abcc523cffb65ce116b7faf9
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 99c1465215beac52fad4c6772c9bfef2209157e4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 12:42:34 +00:00
Alexandru Croitor abb231a2f0 CMake: Only build QtLibraryInfo if we are building tools
It is a dependency for qmake and qtpaths. If neither of them are
built, because building tools might be disabled, skip building the
library as well.

Task-number: QTBUG-127334
Change-Id: I0f7d5bc9d9a4539a6d25f7c2d841e9b8978a83a3
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 82b2c51c3aec148c890d732978ca4a881e5c6f82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 12:42:33 +00:00
Alexandru Croitor f240a7a2bb CMake: Allow building qmake docs in a documentation-only build
We never added the qmake subdirectory if we didn't build tools. Thus
we never created a doc target to build qmake's documentation.

Make sure we add the qmake subdirectory regardless of whether we build
tools or not. qt_internal_add_tool can then make sure to skip building
the tool if necessary.

If the tool is not created though, create a fake qmake INTERFACE
library target, so that qt_internal_add_docs has a target to work
with.

Amends 5c352f47b9

Fixes: QTBUG-127334
Change-Id: I41cc96fb6ad21e32e17d312ea474835dfa38528e
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit aea0f89cfa4aca7e4c7b5056c425fb44ce394770)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 12:42:33 +00:00
Axel Spoerl b572a85b68 Remove GTK3 native menu
QGtk3Menu relied on gtk_menu_popup, which is deprecated and no longer
supported from GTK 3.22 onward. This renders GTK applications
inconsistent, if GTK >= 3.22 is used.

GTK native menus aren't special. They do not blend in with e.g. a main
window or QML ApplicationWindow drawn by Qt itself. There is neither a
performance, nor a visual disadvantage of drawing own menus by Qt.

Remove support for native windows in the GTK3 platform theme.

[ChangeLog][Platform Specific Changes][Linux] Due to deprecation of the gtk_menu_popup() function, we no longer use GTK menus on Gnome: they are now rendered by Qt.

Fixes: QTBUG-124561
Fixes: QTBUG-126598
Pick-to: 6.7 6.5
Change-Id: I031751fb6e070444e99ab2bcac4c622ac509b4c9
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7ffb4c16955a60ffc0f32d990c70476c49ed0b0b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 12:42:33 +00:00
Marc Mutz 6cda03c5d6 QPROPERTY_TEST_COMPARISON_HELPER: don't write 1KiB of NULs
qsnprint() is unconditionally called to fill the buffer and is
guaranteed to NUL-terminate, so there's no point in filling the whole
1KiB stack buffer with NULs beforehand. Leave it uninitialized.

Amends 930e59b798.

Pick-to: 6.7 6.5 6.2
Change-Id: I7da859d609ad4492c9038cb3e14f2a721b2acbe4
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 47c2263e896408e733c9aa466aec388cc4b4a6ad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 10:07:40 +00:00
Volker Hilsheimer 5797326b16 JNI: Constrain QJniArray::toContainer to compatible target containers
We can populate a container with the contents of the Java array as long
as the element types are convertible without narrowing (taking various
special cases into account, such as jstring to QString). The container
has to be either support emplace_back, or be a contiguous container
if a primitive element type.

The template helpers need to be in QJniArrayBase in order for qdoc to
accept the input.

Add test coverage, including static compile time tests.

Change-Id: Id9372deed5cf33446ee1969dc284a88991db2aee
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8f04defa1e3973faec19a9cb1ab9bbf1ea7fb031)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-20 01:13:40 +00:00
Volker Hilsheimer c21612d246 JNI: Improve the constraint on QJniArray::fromContainer
We can create a QJniArray from any container that has a forward
iterator. A contiguous container can be used to optimize the code path,
as long as the element type is primitive (i.e. not an object type).

Fixes: QTBUG-126151
Change-Id: I21915f944d226d6d4f1113a54e5602ddc9cd727e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 71be7834e67216010dc74ed855dc7b513e302f1a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-20 01:13:35 +00:00
Volker Hilsheimer c4bd8a5492 JNI: clean up move semantics for QJniArray
Explicitly define (compiler-implemented) copy and move SMF's for
QJniArrayBase; we need to, as the destructor is declared, so without
them the compiler will implicitly convert an array to a QJniObject
and call that constructor.

Constrain the constructors and assignment operator from a QJniArray of
another type so that no narrowing conversion is allowed. Due to the
implicit conversion to QJniObject, we have to explicitly delete the
overload for narrowing conversions. Use the detector we have in
qobjectdefs_impl.h for that.

Make the detection helpers private, and add test coverage.

Change-Id: I1b2bb4435d52223567d20bb55ceb0d516e3b0b15
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ebbf7b0fdf866190cd20e62d6b13c7c6808101da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-20 01:13:28 +00:00
Volker Hilsheimer 43f0b1fcee QJniObject: specialize the QtJniTypes::Traits to treat it like jobject
It doesn't make a lot of sense to pass QJniObject instances into APIs,
but to be able to consistently treat QJniObject as an object type we
have to register it with the java/lang/Object signature.

Change-Id: Ic40e2676186bf327fa92764da51404985f74b565
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 82254fa836a21b5ec450a4ec7635e72403dded18)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-20 01:13:11 +00:00
Volker Hilsheimer 6c3513f514 QJniArray: implement operator-> for the iterator
The QJniArray doesn't store values, so at() always returns a temporary.
As we cannot hand out a pointer to a temporary, use a wrapper reference
struct that stores the value and implements operator->. It's all inline,
so we can move it out in the future to return mutable references, if we
ever want to enable write access to QJniArray elements.

Change-Id: I3962df6160db8c5b573d47ebb7975864f8ea7a8b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 3d5af4b912e60beb791f874c2dbfef5597b9aad7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-20 01:13:06 +00:00
Morten Sørvig 71f80cff34 wasm: make the "a11y enable" button cover window
Adjust the button geometry to match window geometry.
Screen readers may visualize the geometry, and this
makes it clearer that the button is relevant.

Setting the clip looks to be sufficient to keep the
button visually hidden, even if the canvas (which would
normally be ordered in front) is missing.

Change-Id: Iff268cd2d8f52eead9be88e8cb460b0b445781a9
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit e6c77a0b7eba75e8837dc7bcd98dbc1ba95318f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 13:42:24 +00:00
Tor Arne Vestbø de7a39866c tst_macdeployqt: Only pass -use-debug-libs for debug-and-release builds
When passing -use-debug-libs to macdeployqt it will only consider plugins
that end with _debug.dylib, which is not the case for single-configuration
framework builds as of d3be87ff1d558f05309b1f29f7e71f291498584f.

When not passing -use-debug-libs macdeployqt will use whatever library
it finds, both suffixed and not, so the only case where we need to
explicitly make it choose one is when we have a debug-and-release
build of Qt. Otherwise we can leave macdeployqt to choose the right
one.

Change-Id: Ic438da9f21c3090f0d57ce615bc0c0969b9a600d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 60550f8acc4f9d742f6ef7cb027f0ed3e2d5e42a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 13:42:22 +00:00
Even Oscar Andersen 52c9346f5b Move destruction logic to QOpenGLWindow from Private
QOpenGLWindow has been destroyed when QOpenGLWindowPrivate
destructor runs

Fixes: QTBUG-126845
Change-Id: I4f0208c4adf1a875cdcaca91fc239cf4e6200e4d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c337cdf39cc249560bf9a5380e308d09a4c13b95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 13:42:20 +00:00
Volker Hilsheimer fe284006b2 Doc: link from non-categorized logging API to QLoggingCategory
The <QtLogging> documentation page is easily found, and from there it's
not easy to see that categorized logging is a feature. Add more links.

Task-number: QTBUG-125589
Change-Id: I214b9a561d6fc6b4c8600bc1b1eca04d856678d6
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7c344176d21e00a648bb504da735f174f70f0ad2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 12:33:09 +00:00
Wladimir Leuschner 4b4c5b06a0 QWindows11Style: Use QProgressStyleAnimation for QProgressBar
Currently for an indeterminate QProgressBar in QWindows11Style, a busy
drawing is triggered, consuming more CPU resources than necessary. This
patch avoids the busy drawing by using QProgressStyleAnimation, which
only triggers a redraw for specified Fps.

Fixes: QTBUG-127112
Pick-to: 6.7
Change-Id: I46da8ffcb849563c771dbc72af4c7e8b306b4802
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 384acdc1cf2cc6472c9eb9d2d79077736ded0e92)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 10:11:40 +00:00
Christian Ehrlicher f18862e91d SQL/IBase: Don't let open() fail when lastError() is set
Since QSqlDriver::lastError() always contains the last error, it is not
a valid source to check if the last operation failed or not. Therefore
remove the check for lastError() when initializing the timezone mapping
- the function is optional since an old database might not contain the
timezone mapping table which is perfectly fine.

Fixes: QTBUG-127175
Task-number: QTBUG-125467
Change-Id: I22ea75c004654cead9a4461d2eaccfcbe8a116be
Reviewed-by: Andreas Bacher <andi.bacher@outlook.com>
Reviewed-by: Hamish Moffatt <hamish@risingsoftware.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 9844da5036d7a7a185ddd4eb3fa59bc4ede9e5d7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 06:33:42 +00:00
Christian Ehrlicher 0ff64a5b99 SQL/MySQL: honor schema when retrieving table record
Honor the schema when retrieving the table record - otherwise we might
end up getting the data for the wrong table (same tablename but wrong
schema).

Fixes: QTBUG-127129
Task-number: QTBUG-122723
Change-Id: Ia3e9293dbdc77da760dd4d0702104048187fad5f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 920dfb2f443042777ea9547ff7a8beef56e90d92)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 06:33:35 +00:00
Alexandru Croitor 49193d4afd CMake: Don't add platform CPE to SBOM
It triggers vulnerabilities when loading the SBOM into tools that look
for CVEs matching those CPEs.

Task-number: QTBUG-122899
Change-Id: Ic4949ca5749ce4e297344760d3500d982c9a4449
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit ad0ed9fe307ac01ceb3fadd32816ada961a5afa6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 06:32:59 +00:00
Allan Sandfeld Jensen 9dcedc184c Avoid assert on nonsense input
Fixes oss-fuzz 69439. Credit to OSS-Fuzz for finding the case.

Change-Id: I5211900073377c7bdccb904dbc6ff172419e76f1
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
(cherry picked from commit 913cc91c0abb8087a85984930049f208965b05c9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 06:32:48 +00:00
Volker Hilsheimer aabaf64c25 Doc: fix links to QMetaContainer members
QMetaContainer was not documented at all, so links from QMetaSequence
back to its parent class member functions failed.

Add generic class documentation for QMetaContainer. The QMetaAssociation
class is also undocumented, but since QMetaContainer's purpose is to
provide common APIs for both QMetaSequence and QMetaAssociation, mention
it anyway.

Fix warnings from incorrectly named parameters in the QMetaContainer API
documentation, which now gets generated.

Change-Id: I50a9f3ebf90b03f049804be2256ff135f57dab14
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 84be9b069c93afe62082ecd6aa5ec97ce44a8e0f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 06:32:08 +00:00
Thiago Macieira 091d732b15 QDnsLookup/Unix: fix buffer size on sending DNS queries
Commit f2f00b2a46 ("QDnsLookup: implement
DNS-over-TLS") added the use of QSpan, but confounded the size of the
buffer array with the size of the query we prepared. The queryLength
variable was never used after checking if the preparation had failed.

Task-number: QTBUG-127073
Change-Id: Iac1ff680887641888e00fffd17e0e49faab1d579
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 59133b16cd3adffc70833bb2b81332c9649fa51e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 04:21:50 +00:00
Marc Mutz c3477a7375 [docs] qvsnprint(): mention %a and %ls differences on WASM/Android
Pick-to: 6.7 6.5 6.2
Task-number: QTBUG-127110
Change-Id: I919170881846f3a08890ac0a8accfb859157d193
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1aedd4d7c9968054a1c2880000a5007bb826a179)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-18 13:32:03 +00:00
Marc Mutz 6c21f8103b q(v)snprintf(): mark the functions as \obsolete
We can't deprecate them, yet, because there are way too many users in
Qt and 6.8 is too close by now, but we should give users a heads-up
that better alternatives exist these days.

Pick-to: 6.7 6.5 6.2 5.15
Task-number: QTBUG-127110
Change-Id: Ic14e9d12fc746fdc65d6c0006756c37339aa25f0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3f54c71b78e4ed4ab513190bbcda89ae27256377)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-18 13:31:49 +00:00
Allan Sandfeld Jensen 85b7aeaddc Fix source compatibility with existing toString() extensions
Change-Id: I946ebf0f0fa82450105e720489c4da35a77078d8
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7dd2c5f91dd62840d37c5e17cc3f1f5ad46d9366)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-18 11:55:37 +00:00
Mate Barany 1f72315adc Pass QNetworkRequest::Priority by value
It is a small and trivially copyable type.

Found by an Axivion scan.

Task-number: QTBUG-125026
Pick-to: 6.7 6.5
Change-Id: I7990d07a7062472108ab3fff8a135f1917c4f7c7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8448292074e72095ed177d77910abe47a24f318c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-18 11:16:58 +00:00
Alexey Edelev 7b8cbbff76 Add the note about the runtime encoding in the QString-like classes and QT_NO_UTF8_SOURCE
Mention that QT_NO_UTF8_SOURCE has no effect on runtime encoding of
QString-like classes.

Amends 37e6159ab0c1456e8dc38f38f3b21643585c1273

Pick-to: 6.7 6.5
Task-number: QTBUG-126435
Change-Id: I3629b8af0e3eb7353c9268e23167dbef6802bb00
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit bba0150200e16e6e0a8926dac1f32b00b8b1493b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-18 10:26:00 +00:00
Marc Mutz fc4a3a8cfc qxptype_traits.h: include q20type_traits.h
A qNNfoo.h should always include qMMfoo.h, MM=NN-3, if that exists, to
avoid a user having to include both qNNfoo.h and qMMfoo.h, which later
become two <foo> includes on automated replacement. For the purpoes of
this argument, NN=xp is considered equal to max({MM : ∃qMMfoo.h}) + 3.

Following this logic, qxptype_traits.h should include q20type_traits.h
(q23type_traits.h doesn't, yet, exist).

It didn't, so fix.

Amends def2a3de37.

Pick-to: 6.7 6.5
Change-Id: I8153d241783dc4e505fddf2407d27990e5c522f4
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 720ae32f79038a5db763a2371c0e8d25d32d93cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-18 08:42:51 +00:00
Marc Mutz 4c55f496d7 QThread::terminate(): don't depend on stack unwinding
Posix doesn't seem to specify whether the stack of cancelled threads
is unwound, and there's nothing preventing a QThread from
terminate()ing itself, so be extra careful to drop the mutex before
calling pthread_cancel.

We can't drop the mutex in general, as that would open a window for
the following race condition:

   T1                       T2
   t3->terminate()
     lock();
     read ID;
     terminated = true;
     unlock();
   ----------- t3 exits naturally -----------
                            t3->wait();
                            t4->start(); // gets ex-t3's ID
     pthread_cancel(ID) // oops, cancels new t4

But we can drop it when this == currentThread(), because said window
does not exist: While this_thread is executing terminate(), it cannot
at the same time exit naturally.

As drive-by, scope a variable tighter.

Pick-to: 6.7 6.5
Change-Id: I77a628e62d88e383d5aa91cfd97440186c997fc4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 272c0215c2058bc267abf0a247da878f652eaffa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-18 08:42:45 +00:00
Andras Mantia 7b9505eb86 Fix copy-paste error in the QMultiHash documentation
Pick-to: 6.7 6.5
Change-Id: I769a94710994a17160cca7f00243a634d8caf29c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6f70ab027e785590f61357f907002aa3b4fd1aca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-18 08:10:31 +00:00
Marc Mutz 93e39f7b79 QAnyStringView: check QASV(char) isn't UTF-8
... it is. Filed QTBUG-125730 to track this and discuss how to deal
with it.

Pick-to: 6.7 6.5 6.2
Task-number: QTBUG-125730
Change-Id: I2c680e1a9e8dda43700468a544ac645e1fa3aa53
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3ff55648cee8365fb7825ca7a038596b63757ea3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-17 16:26:27 +00:00
Marc Mutz dabfdb5f2d QSingleShotTimer: de-inline [4/4]: clean up includes
Include what you need, don't rely on transitive
includes. Forward-declare what you need in-name-only.

Also port the one unchanged include in the header
(qabstracteventdispatcher.h) to idiomatic form. It's an unrelated
change, but it looked so lost among the QtCore/ headers, I felt pity.

Amends e0573e7364.

Change-Id: I4f25df7465f08378bc4e003bde12c28f4d231f14
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 49d5b0a5a10634841122bbbc5e986ce307e7017a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-17 13:40:56 +00:00
Kai Köhne 661ab8398e Doc: Fix typo in snippet
Change-Id: I1a93a5f58bc5edc07c5449f20eb2444ebc252a61
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 3e1f73aa30761533b5a897ee0ee6d7ce33f5b4bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-17 13:40:55 +00:00
Alexey Edelev 861664b9d9 Add documentation for the QT_NO_UTF8_SOURCE property
Add the missing documentation for the QT_NO_UTF8_SOURCE. The property
can be set directly or using the qt6_allow_non_utf8_sources function.

Fixes: QTBUG-126435
Pick-to: 6.7 6.5
Change-Id: I2a255e6d4f761f14a2fa30ae51b4f671ed75586f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 37e6159ab0c1456e8dc38f38f3b21643585c1273)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-17 13:40:55 +00:00
Edward Welbourne 6a0f00ac4e Update CLDR to v45, adding language Kuvi
This was in fact present in v44, but we overlooked it somehow. The new
version also fixes some inconsistencies in the data, that I reported
against v44.1; in particular, Tamil no longer claims to override the
root AM/PM markers (probably because it uses 24-hour time so doesn't
need them).

Add the test-file under util to the list of files containing generated
content.

Conflict at 6.8 resolved by regenerating the data; this only changed
the date of generation, not the data. Then hand-edited the date to
match the picked upstream commit, to avoid future conflicts.

[ChangeLog][Third-Party Code] Updated CLDR data, used by QLocale, to
v45.

Task-number: QTBUG-126060
Pick-to: 6.7 6.5 6.2
Change-Id: I81a5bcca49519b55091fc541de6b73b606661bb4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f79548e268a496698d77d0e78365334d0e507212)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-07-17 12:57:30 +02:00
Edward Welbourne b68eaebc86 Update benchlib's 3rdparty cycle counter to FFTW v3.3.10
Document cycle_p.h's provenance - thanks to Morten Sørvig for digging
that up - and update to its version in the most recent release of
FFTW. Include patches to apply (after purging dangling hspace) for
future updates.

[ChangeLog][Third-Party Code] QtTest's benchlib now uses FFTW
v3.3.10's version of the clock-cycle counter, Cycle.

Task-number: QTBUG-126080
Change-Id: Ib59bc53e5d74cfdc889c03e78f9dd72100168f64
Reviewed-by: Jason McDonald <macadder1@gmail.com>
(cherry picked from commit 6e7c158152cef6a1ae6a628f08661fcc4b27de90)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-17 10:33:01 +00:00
Volker Hilsheimer 8e703f6e21 Touch event dispatching: change qCWarning to qCDebug if no target window
Warning messages are by default emitted for qt.* logging categories. But
neither the end user nor the application developer can do anything about
this particular warning (which gets emitted on macOS when using the
touch pad) - it's only useful for Qt developers.

So change the logging level to debug.

Pick-to: 6.7 6.5
Fixes: QTBUG-125589
Change-Id: I36e6e553494054488209139e3238b7bd11bd170a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 2b021b2f927eaabbb3b7892b3dfe35d41368cf32)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-17 10:32:59 +00:00
Lena Biliaieva c373e728c8 QHttp2Connection: Add test for CONTINUATION frames
Task-number: QTBUG-122458
Change-Id: I6c87a7361852bb04173f0216e69cd7c5309a242b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 6aa1cb05e357cf4221aaedd4cf742c45983af446)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-17 10:32:58 +00:00
Marc Mutz 4e26c36171 QThread: fix race condition between parallel terminate() calls
QThread::terminate() is documented to be thread-safe, but had a race
condition: If multiple threads call terminate() on the same thread,
the following could happen:

  T1                     T2

  t0->terminate();
    lock();
    read ID;
    pthread_cancel(ID);
    unlock()
                         t0->terminate();
                           lock();
                           read ID;
    (OS thread finishes)
  t3->start();
    (creates a new OS
     thread with same ID)
                           pthread_cancel(ID); // cancels new t3!
                           unlock();

To fix, record that the thread was already terminated using a new
boolean flag.

An alternative would have been to fetchAndSet() the threadId to nullptr
and only let the thread that actually nulled it call pthread_cancel(),
but that would be harder to restore to the previous state in case
pthread_cancel() fails, and a null threadId might cause other problems
down the line, esp. if cancellation is currently disabled. The
explicit state is much simpler to reason about.

Fixes: QTBUG-127055
Pick-to: 6.7 6.5 6.2 5.15
Change-Id: Iec180bdfaaf913a3a1560210c781966dc99c0d42
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit d8bd4c2306f2acfefc75f8163b58f2037596dc65)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-17 09:30:17 +00:00
Volker Hilsheimer d2730bc303 Logging: use qCDebug/Warning/Info when for categorized logging
When building qt with QT_NO_DEBUG/WARNING/INFO_OUTPUT set, then the
qDebug/Warning/Info macros expand to `QMessageLogger::noDebug`. That
helper is not defined to take a logging category or category function,
so using `qDebug(lcX, ...)` breaks the build. The correct way to emit
categorized logging is to use the qCDebug/Warning/Info macros.

Task-number: QTBUG-125589
Pick-to: 6.7 6.5
Change-Id: I968b0e826871a09023c11fec9e51caa5a2c4dc0b
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
(cherry picked from commit 1e1c68017338c89265d6664a27f4137fc8960473)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-17 01:49:15 +00:00
Axel Spoerl 678dccb7ac Revert "Update window state in QWindowsWindow and QXcbWindow geometry setters"
This reverts commit 99c8ffb9f2. It fixed
QTBUG-104201, which in essence pointed out a state mismatch between
widgets and platform windows on Linux (X11 and wayland). Mismatches
occurred in the margins between calls to QWidget and async screen
rendering: While the widget layer reported the expected size, the
platform layer did so only after the rendering thread had finished.

As mentioned in the comments of QTBUG-104201, the state mismatch is
predictable, temporary and consistent.

By bridging the time gab, an async operation was made to look
synchronous. That gave more comfort to application developers. By
oversight, it broke code that relied on the platform window state
reflecting physical rendering. This has caused QTBUG-126479 as a
regression.

Both purposes can't be served at the same time: The platform window
state either reflects rendering, or the expected state. It's therefore
justified to revert.

Reason for revert: <Causes QTBUG-126479>

Pick-to: 6.7 6.5
Fixes: QTBUG-126479
Task-number: QTBUG-104201
Change-Id: I22380a6a463822a1cb4be90a44d2775954c7ca82
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 7d7be38d95eb82ef3e0be5250440072d8b5bc4b2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-17 01:49:09 +00:00
Rym Bouabid 35562e8e0a QExplicitlySharedDataPointerV2: Add unit-tests
The tests are needed for the next patch where we modernize comparisons
and wrap the pointer, which involves changing most of the functions.

Pick-to: 6.7 6.5 6.2
Change-Id: If635538bfca33e410e19472d32b9666d258f96a9
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit b44541d8a42b7fc0b24cde4086b0030623280cc0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-16 15:37:55 +00:00
Ivan Solovev 4cdb6991c5 Remove QBAV(QL1SV) and QBAV(QU8SV) constructors
They were added because of conditional noexcept on the relational
operators that was preventing the other constructors from being picked
up by the compiler.

Now when we removed the conditional noexcept on the relational
operators, we no longer need this constructors.

This patch reverts bd581e35e7485cf42fbefd250be7b146737d9d41 and
partially reverts fff6562f8c.

Change-Id: I22cb4507bff0a929a25d2f15caed66cc30d20dc9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6cafe0f2b48c5f07f07de52490b1d07c7325557b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-16 11:32:19 +00:00
Ivan Solovev 65ef677131 Rework comparison helper macros to get rid of conditional noexcept
The conditional noexcept in comparison operators is known to cause
problems in various cases.
For example, we had a problem in QBAV, where gcc and clang tried to
expand conditional noexcept before the class was complete, and, as a
result, discarded some of the QBAV constructors (see
fff6562f8c for a more detailed
explanation).
Other problem is related to the GHS compiler which tries to compile
the noexcept specification and provides a hard error instead of
SFINAE'ing out in case of failure
(see e1f45ad818 or
0ac0b412c754e53d167716f207be9d76a7fe16be as examples).

This patch reworks the macros to get rid of the conditional noexcept.
Instead, it demands that all operators are noexcept by default, and
adds another set of helper macros that can be used if it's not
possible to make the relational operators noexcept.
The new macros end with the _NON_NOEXCEPT suffix.

The patch also adds static_assert() to the generated operators to
verify that the proper macros are used. However, some platforms
(e.g. QNX and Integrity) fail to handle conditional noexcept on
lambdas, and so we have to use yet another macro to generate the
checks only on platforms that handle them properly.

This patch also applies the new approach to qtbase, adding noexcept
where possible, and falling back to the _NON_NOEXCEPT macros
otherwise.

As a drive-by: fix the macro implementation to use
QtOrderingPrivate::reversed() instead of manually reimplementing it.

I decided to pick the patch to 6.8, because it allows to fix some
questionable APIs (see QBAV story above).

Change-Id: I72f56778acb469f18b578b3418c0c41b4f6d62e7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d292648d0bbac50388dae035dc34782accb3807f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-16 11:32:19 +00:00
Lena Biliaieva c26e16e1d4 QHttp2Connection: Return connection error if CONTINUATION isn't expected
According to RFC 9113: A CONTINUATION frame MUST be preceded by
a HEADERS, PUSH_PROMISE or CONTINUATION frame without the END_HEADERS
flag set. A recipient that observes violation of this rule MUST respond
with a connection error of type PROTOCOL_ERROR.

Task-number: QTBUG-122458
Change-Id: I1a052b1f4fc80aa73fad4fc18e3c063fb738ae4e
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 10b7b7fcf06d4ed5492e946ac93eb232c168e686)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-16 11:32:18 +00:00