71231 Commits

Author SHA1 Message Date
Eirik Aavitsland
b82a0cb15f Add Qt-Security tags to texture file reading code
According to QUIP-23

Pick-to: 6.8
Change-Id: I286f76e72a253b67b033a88d24bacdefb714e58f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 5ef9b4efe128b4c26845c9e1f19e3e9be429c19c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-15 00:12:41 +00:00
Morteza Jamshidi
74ef408290 Fix header generation issue with multiple qt6_add_win_app_sdk calls
Use EXISTS path insead of using find_path because find_path finds the
last target's generated headers, but we want to generate headers for
each target separetely.
Ammends 95c70bbc5bed906fc3d24eebfb00592d48b30a74

Fixes: QTBUG-124800
Change-Id: Ib2b9ceefbc6d11f9bf67fdc6ce25dea3366afe3d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 15932205522fc695168f79869fc7d78d65596739)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-14 10:48:01 +00:00
Marc Mutz
05cab5fdac Mark QSimplex{,Constraint} final, AnchorData non-copyable
These final touch-ups for CID 390828 make the code easier to
understand and safer, because more unsafe operations are now forbidden
(subclassing and copying).

Coverity-Id: 390828
Pick-to: 6.8 6.5
Change-Id: I2e43be71d8c3db59d95e69ec16c41c1547a2f180
Reviewed-by: Magdalena Stojek <magdalena.stojek@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 912388b3068e831e4fbd9b3c31a62c79ee91c72d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-14 09:11:43 +00:00
Marc Mutz
3d0243711e qhighdpiscaling: de-pessimize optional<> use
std::optional::value_or() should not be used when its argument is a
non-trivial type, because the argument is created and destroyed
independent of whether it is used in the end. In this case, we don't
even need an optional, because parseScreenScaleFactorsSpec() takes
the output of qEnvironmentVariable() (not -OptionalString) as-is, so
we can just drop the unneeded optional-(un)wrapping.

Since this patch apparently removes the last user of
qEnviromentVariableOptionalString(), mark that function as
[[maybe_unused]]. Outright removal may cause cherry-picks to fail,
so will come as a follow-up.

Amends 4d1f13f3549a73f5ca4e64dac9137e83138080fa.

Pick-to: 6.8 6.5
Change-Id: Ic2bb8a3aa8e946b957047ff4faf48c4082fc9c01
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit bee49bde04777eae348aead0abc3212fa945c0ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-14 01:14:08 +00:00
Marc Mutz
52b20a1351 QImage: introduce a class invariant that format() is in-range
Coverity complains that image.format() is used to index into
qPixelLayouts[] when it may be NImageFormats.

Most code paths (e.g. QImageData::create()) defended against that, but
e.g. QImage::reinterpretAsFormat() did not (at least not overtly), as
didn't some of the backend functions.

Add checks, document the invariant on 'format' and assert it in
QImage::format().

If this doesn't convince Coverity, we'll need to turn qPixelLayouts[]
into a function, so that it can defend itself against out-of-bounds
access.

Pick-to: 6.8
Coverity-Id: 390711
Coverity-Id: 390720
Coverity-Id: 390758
Change-Id: I29431193face3cae8be56f01da8dced19c3abb38
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit a2e60ebee3737548d1be14fdbb39b08c515ae602)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-13 21:09:31 +00:00
Thiago Macieira
cd395a7999 3rdparty: update TinyCBOR to v0.6.1
[ChangeLog][Third-Party Code] The copy of TinyCBOR in Qt was updated to
0.6.1.

Manual conflict resolution for 6.9:
- worked around 34f60877bdb54786c62fd1bf5b44a81430aa411f not having
  been picked to older branches

Pick-to: 6.9.0 6.8 6.8.3 6.5 5.15
Change-Id: If5d5ef6220874ae8858efffd1712a567597b6317
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 7df128675a22391bc3ade2a45b558bc38eee1c67)
2025-03-13 07:58:02 +00:00
Marc Mutz
6d2421d812 QGraphicsAnchorLayout: make createSlack() return a proper struct
... instead of std::pair.

This is in preparation of breaking QSimplexVariable up into
QSimplexVariable (with protected dtor) and trivial subclass
QConcreteSimplexVariable, to statically ensure that we're not deleting
derived classes (AnchorData) through QSimplexVariable pointers (which
is UB, and subject to a Coverity complaint).

This is basically the same program we did for QBrushData, culminating
in 3bbc9e29ef59683351cf35c19a8bd4a030615c64.

This second patch modernizes the code a bit and, by scoping the
variable holding the return value of createSlack() tighter, allows the
use of auto and therefore isolates the code from the changes in the
final patch of the series.

Pick-to: 6.8 6.5
Coverity-Id: 390828
Change-Id: I15b51a3118c7ef33e8351a3e198abaebf4300d61
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 3aa431e3fe42d7eb943f6b9920ad47b074856abe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 23:52:00 +00:00
Marc Mutz
e02348117c QSimplex: scope iterators tighter in for loops
This is in preparation of breaking QSimplexVariable up into
QSimplexVariable (with protected dtor) and trivial subclass
QConcreteSimplexVariable, to statically ensure that we're not deleting
derived classes (AnchorData) through QSimplexVariable pointers (which
is UB, and subject to a Coverity complaint).

This is basically the same program we did for QBrushData, culminating
in 3bbc9e29ef59683351cf35c19a8bd4a030615c64.

This first step scopes iterators of for loops in the for-loop, and, as
drive-bys, makes them use auto and the shorter cbegin()/cend(), so
they fit into a single line, and fixes the extra {} around single-line
bodies (only in touched lines).

Pick-to: 6.8 6.5
Coverity-Id: 390828
Change-Id: I439e0a10ebb316a33e92c42c255ee209139d47a2
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 49809c6e41101a11b5a264c7e8b4d4ce05d3c04a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 23:51:54 +00:00
Marc Mutz
18f0dd9bdf QCssParser: statically verify QCssKnownValue arrays
Port from explicit array sizes to implicit ones, followed by an
explicit size check. This prevents mistakes where, due to missing
initializers, value-constructed trailing elements cause lower_bound()
to be called out-of-contract, such as the one
5d8f815e101da3ae9cd6a666cc097853f52b21da fixed.

Also statically verify that the arrays are sorted. This doesn't work
on GCC < 10, e.g. QNX, so guard it the same way we did in
qhttpheaders.cpp in e3fe3997ebd2baaafdfa7aa3c1eb95e8048268f8.

Task-number: QTBUG-103721
Pick-to: 6.8 6.5
Change-Id: Ia55149102013fa4e1619be68a69bc52b46e0f006
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit ddf69669d39919b20a2710211911587353fa3dce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 23:51:53 +00:00
Alexey Edelev
8909279d3e Ensure optional_arg is reset in qt_internal_add_global_definition
Othewise there is a risk that variable is taken from other scopes.
(Random finding).

Pick-to: 6.8 6.5
Change-Id: I2517adec5d82639e95ac2758633109413811cf9a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 6685da4ec9e3b1eb8a09052c3abb2d614f96d7cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 21:55:31 +00:00
Kai Uwe Broulik
66a10a141e QTabWidget: Draw base for corner widget only if QTabBar::drawBase
QTabBar draws PE_FrameTabBarBase only when drawBase is enabled,
so QTabWidget should honor this as well.

Otherwise, there will be an awkward line below the corner widgets
but not the tab bar when disabling drawBase on the built-in QTabBar.

Pick-to: 6.8
Change-Id: I7621476d66c3580282846dc924cd0b3700ce250f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit d28881fa335f20947b0329bc8f537bf7b577a257)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 20:37:09 +00:00
Marc Mutz
4a352937e3 Long live Q_PRE/Q_PRE_X!
As decided with lazy consensus on the development ML¹, we'd like to
separate precondition checking from internal consistency checking.

Add a new Q_PRE/Q_PRE_X macro for the former, to leave Q_ASSERT/_X for
the latter.

As requested in review, modernize Q_PRE_X vis-a-vis Q_ASSERT_X by
skipping the `where` parameter (defaulting it to Q_FUNC_INFO).

Added as undocumented API, for now, to pick back to all active
branches without actually promising semantics different from Q_ASSERT,
a change that, realistically, will only happen for 6.10 at the
earliest. But by making the macro available to all active branches, we
avoid conflicts when picking changes back, and the change is rather
risk-less.

Apply to QStringView, to have at least one user.

¹ https://lists.qt-project.org/pipermail/development/2024-August/045588.html Items 1-3.

Pick-to: 6.8 6.5
Task-number: QTBUG-98965
Change-Id: Ia04248a64c8feba80cce10f8f5cbde580436db88
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit eb3df4edbc0ca04a892728e54962ad0daef4a78e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 20:07:36 +00:00
Thiago Macieira
97b41af2a2 QThread/Unix: split the destruction of the exiting thread's QThreadData
As noted in the comment, we had a chicken-and-the-egg problem with
plugins and the event dispatchers: we need to destroy the event
dispatcher when plugins are still loaded (otherwise we could and did
crash) but we also wanted the QThreadData to exist when the plugins
unload.

The solution for that is to split the work: destroy the event dispatcher
first, then unload pugins, then destroy the current thread's
QThreadData. On ELF systems, this is guaranteed to work because we set
the init_priority to call destroy_current_thread_data() to higher than
QLibraryStore. In other systems, it's a best effort with dynamic
libraries and not guaranteed at all with static builds (don't even
report bugs).

Fixes: QTBUG-134080
Fixes: QTBUG-133861
Task-number: QTBUG-132697
Task-number: QTBUG-102984
Task-number: QTBUG-132381
Pick-to: 6.9.0 6.8
Change-Id: Ifaa28bb87338f4117d51fffdf721da68c0762e5a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 6763e25cbc16cf8c54ab9b1ef97030aab9bb0eec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 15:16:35 +00:00
Lucie Gérard
5fb7e0ccbb Update licensing of files with infrastructure type
A QUIP 18[1] update sets git files, REUSE.toml and licenseRule.json
as infrastructure type files. They are licensed with:
LicenseRef-Qt-Commercial OR BSD-3-Clause

[1]: https://contribute.qt-project.org/quips/18

Pick-to: 6.8
Change-Id: Ia7b9ae097ff80bd184256e0b7efa0dd7cfa63def
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit e70d7e611e3f3a02c56ae60001edad046a34fc62)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 15:16:35 +00:00
Shawn Rutledge
ed75628c37 Mark HTML, CSS and Markdown parsers as security-critical
Pick-to: 6.8
Task-number: QTBUG-134508
Change-Id: Ib973b9344a19fa2f8c79e2a2ceddf530d9ab62cd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 2a85bdc77a5822dc228374a5d18bc416b7b1820c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 15:16:34 +00:00
Wladimir Leuschner
a3fb8e9abc WindowsQPA: Add default window title to custom titlebar
In case that no window title was provided use the
QCoreApplication::applicationName when Qt::WindowTitleHint was provided.

Fixes: QTBUG-133942
Change-Id: Ieeff0ba97bd996225c6f83f691fc1c149e3d7172
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5d8c3a598588a950aa8dbab7a72cc5e6de7bd3a3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 15:16:34 +00:00
Marc Mutz
e897b68239 qdrawhelper: (attempt to) fix Coverity warning about op being uninit'ed
Unlike in other cases of structs, Coverity doesn't say which field,
exactly, it considers uninitialized in `op` upon return from
getOperator(). Manual checking confirms that all fields are written in
all branches (and all configs, btw), with the following exceptions:

- src* fields are not written in QSpanData::None mode, but this branch
  is marked as Q_UNREACHABLE()

- `linear`/`radial` are only written in QSpanData::Linear- or
  RadialGradient mode, which means that their (unnamed) union is not
  written in Solid/ConicalGradient/Texture modes

Assuming it's the latter branch that trips Coverity, introduce a
std::monostate member, noGradient, to said union, and initialize it
Solid/ConicalGradient/Texture modes. This makes the union a kind of
optional, but without the churn of actually introducing a
std::optional<Union>.

The effect is that in those modes the active union member is now the
empty monostate, so static analyzers will not complain about `linear`
or `radial` being uninitialized (because they're not active members).

'noGradient' being the active union member should also help statically
and dynamically (ubsan, one day?) detect accesses to `linear` or
`radial` when they're not active. Before, I believe the first declared
of the two was implicitly active.

Amends the start of the public history.

Pick-to: 6.8 6.5
Coverity-Id: 11400
Change-Id: I743363cc06af3778f85c205bfb6880c696229f92
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 8492ba01ba3e3bdf717c9e7f40ddad412c297945)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 15:16:33 +00:00
Magdalena Stojek
72564afb5f Expand Qt XML documentation on behavior changes in Qt 6
Adds a more detailed overview of behavior changes between Qt 5 and Qt 6
in the Qt XML module. This update is based on multiple reported tickets
highlighting behavior differences, where users requested further
explanations.

Fixes: QTBUG-134503
Pick-to: 6.8
Change-Id: I2e25268c6de7fd7e3a0e0244b83bb2ba616ef60e
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 275396b013cf10fa647c3b6a262ae46f180621d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 11:21:46 +00:00
David Faure
b26e30e1b7 QKeySequence: tolerate spaces when parsing a key sequence string
Fixes: QTBUG-130063
Pick-to: 6.8
Change-Id: I0f0aff0ca0824cd1c9297cd18a1f5cf9a2a44951
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit ada885dfd55d5c386d04039babee43e49ccab5c5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 11:21:46 +00:00
Lauri Pohjanheimo
598db6f4b1 SwiftShader sw check added to enable tests on hardware
On CI an Android emulator with SwiftShader software graphics
implementation is used. SwiftShader implementation is unable
to emulate this OpenGL functionality.

QSKIP the test if it is run in Android platform,
OpenGL and SwiftShader sw graphics implementation is found.

Task-number: QTQAINFRA-6333
Task-number: QTQAINFRA-6334
Pick-to: 6.8
Change-Id: I560aa796e7f364e645ebb41f89120673a0f59a5b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-03-12 11:21:45 +00:00
Marc Mutz
a069569ea2 QTextMarkdownWriter: reduce unnecessary relocations
Instead of a static constexpr QL1SV object (which force the compiler
to allocate storage and therefore causes relocations), use a mere
automatic constexpr object (which doesn't). There never was a need to
make this object static, as constexpr is enough to force the compiler
to constant-fold them.

Difference:
  qtextmarkdownwriter.cpp.o:
- 0000000000000000 l     O .data.rel.ro.local     0000000000000010 maybeEscapeFirstChar(QString&)::specialFirstCharacters
  0000000000000000 l    d  .data.rel.ro.local     0000000000000000 .data.rel.ro.local

See
  https://stackoverflow.com/questions/19067010/finding-where-relocations-originate/19338343#19338343
for the script to generate this output.

See https://www.akkadia.org/drepper/dsohowto.pdf Section 1.6 for why
we care.

As a drive-by, port from QL1SV to _L1 UDL.

Amends ca4774131b9b8ee40b4d7f5c1ba296af4700207f.

Pick-to: 6.8
Task-number: QTBUG-100536
Change-Id: I31e124962e03b8b40df9153b09f627e8e22a8119
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
(cherry picked from commit db6f8821fcf0028f83b4c27c8de2399c99577272)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 11:21:45 +00:00
Marc Mutz
55fadd025b QCssParser: shrink indexOfId by half
All offsets fit into [0:255], so use uchar instead of short to store
them, cutting the storage requirement of the array in half (-86 bytes).

As drive-bys
- make the array constexpr
- fix formatting (only in touched lines)
- port from explicit to implicit bounds with explicit bounds checking

The latter has the advantage that we don't get value-initialized
elements appended silently, cf. 5d8f815e101da3ae9cd6a666cc097853f52b21da.

Pick-to: 6.8 6.5
Change-Id: I336f850a586fd2fde8f62c65223f547402fbaa75
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 67e9e2a7e2ee6a7687a5aa01214e70dffb6eb688)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 11:21:45 +00:00
Moss Heim
ba5e146082 Docs: fix typo
\l instead of \\l

Amends d3117e97014af029b2c117daef9695b87103ab25.

Pick-to: 6.8 6.5
Change-Id: I0b6aaef6de839f29e0671d382d4555f8ab0afe47
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7bec2f6b4278a6331d1991f32a8d8fc637c9c584)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 11:21:45 +00:00
Christian Ehrlicher
6cdae4ea3e QIcon: call qt_findAtNxFile for all devicePixelRatios available
QFile::addFile() was searching for '@N' - image file where N corresponds
to the devicePixelRatio of the QGuiApplication. Since we can have more
than one screen, all different devicePixelRatios should be considered.

Change-Id: I7c844e163c5b5ca8752d8461139d7abf39c2e8a5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9684691d51335362665e85ced591cffae3ea5360)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 11:21:45 +00:00
Eirik Aavitsland
9a8bc72b93 Add Qt-Security tag for ICC profile parsing
According to QUIP-23

Pick-to: 6.8
Change-Id: I7c7b24d8a2d0ca8ae0b330573839723497fdfd38
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 523973f16b378956d41a33f4d270e6aa70f025da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 11:21:44 +00:00
Eirik Aavitsland
2f3faf7c8e Add Qt-Security tags to gui image, icon and imageio files
According to QUIP-23

Pick-to: 6.8
Change-Id: I10d6109d2365e9252ab60f5c3bdfc8de2d606f15
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 5157ce7c59b704bd080908f24c6ccdf7cb585eeb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 11:21:44 +00:00
Mitch Curtis
bd2bc4087f Make dprgadget manual test directly openable in Creator
This avoids the need to run qt-cmake-standalone-test and then import
the test, as described in QTCREATORBUG-25389.

Pick-to: 6.8 6.5
Change-Id: Ie9694569c24dc0c714c2538819e7d9d8ff7e44e4
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit b35ea9b974c965c01cd0a8340a7885621e4413ef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 06:07:48 +00:00
Aurélien Brooke
cf12826dc4 QArrayDataPointer: use Data::deallocate() instead of raw free()
Be symmetrical with the Data::allocate() in the constructor.

This is not strictly a no-op since we now call the exported symbol
QArrayData::deallocate() instead of inlining a free() call. However, it
allows future sized-free optimizations.

Pick-to: 6.8
Change-Id: I2ef00a897f56a32a0f1188f69f159834e6ca5b64
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 41c47fdd192cafa001b6e67defc314af5c1d6316)
2025-03-12 05:58:22 +00:00
Mikhail Paulyshka
1921783936 qsimd: perform RDSEED sanity check in case if available
Fixes: QTBUG-134538
Pick-to: 6.8 6.5
Change-Id: Iab51337b9b27ccf48a0e60c08cf14706112b6235
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1b8d08532227866409088c6c45e215acfbf33cc7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 05:58:22 +00:00
Marc Mutz
f249a5182f QMovableArrayOps::Inserter cleanup [3/3]: cut out the where middle-man
It turned out that we've been maintaining both displaceFrom and its
copy, `where`, in parallel.

This is not needed, so only maintain displaceFrom.

Pick-to: 6.8 6.5
Change-Id: I8c13420ae3fd284e362c4dd1f1b06d2847780c86
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit f18e8cebfcb9053bec3221f88a3944a781114530)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:32 +00:00
Even Oscar Andersen
ae145bd28f Add QAccessible::LocationChanged to QWidget
Issue the event when geometry has changed to match QML.

Task-number: QTBUG-115926
Pick-to: 6.8
Change-Id: I31d87a2b07c1cbdb31063bdbf146f21310103798
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c1fba2d4ee47d2ce69b56d69629cd13b1439a107)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:29 +00:00
Volker Hilsheimer
c90130a72d QDockWidget: fix documentation of the new dockLocation property
Follow the standard syntax for property documentation.

Amends cbd2f56c14159a1a566f4e423b910256724fdb6a.

Pick-to: 6.9.0
Change-Id: I3557eba1990b684a35ab70f95e7f8ccf33850537
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit df96b28f65ad0ba1094c756929cfcdd9f19e4529)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:29 +00:00
Marc Mutz
619af4198e QHttpHeaders: de-pessimize Private::replaceOrAppend()
All callers of replaceOrAppend() (present and future) pass an rvalue
`value`, so take advantage of C++17 guaranteed copy elision, take
`value` by value and move it into place.

Even for implicitly-shared classes, a move (pointer swap) is cheaper
than a copy (atomic ref-count upping/downing; ca. 100x slower than a
normal int).

Amends d8f6425fef1050525480afec662a417a7645c22e.

Pick-to: 6.8
Change-Id: Ia52a2ec2c079f515f92b0890e42669d4ba435c20
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit 8761fa5b8bec2f9b80550523e824f4e3141aca49)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:29 +00:00
Marc Mutz
5482f0d0a9 QQOpenGLProgramBinaryCache: split FdWrapper to fix a Coverity UNINIT warning
Coverity complained that mapSize was used in ~FdWrapper uninitialized
when the object was destroyed before map() had been called on it. This
is a False Positive, because in that case, ptr == MAP_FAILED, and we
wouldn't be reading mapSize.

But be nice and split the FdWrapper class into two, by creating an
object managing only the mmap() part of equation and returning it from
map(). The most-natural choice for such an object would be a
unique_ptr with a custom deleter, but that has built-in knowledge of
nullptr (ie. doesn't call the deleter on nullptr), which, at least
theoretically, is a valid return value of mmap() (the error case is
(void*)-1), so write a small struct ourselves.

Coverity-Id: 390668
Pick-to: 6.8 6.5
Change-Id: I43d635617bd26120cf402241bf59680fe63d071a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 1d2dda041a419740dff16dbb4addc6d93583f08d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:29 +00:00
Marc Mutz
a211cb81ee QUnicodeTools: collapse adjacent identical case statements
They were left in to for easier reviewing when the old function
pointer table was changed to this switch. In this second step, we can
now collapse adjacent duplicates into one each.

Pick-to: 6.8 6.5
Change-Id: I7b7fa8991817895a01c63251ab3b0ecc95b5756b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 455e0ff42a68849b8d76dd8fbac58a35fa2dc866)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:28 +00:00
Matthias Rauter
b330d8e06a Fix mistakes and inconsistencies in string overview
Amends 80b6f2e63dc537f419186585a528ff749f9ff739

Pick-to: 6.9.0 6.8
Task-number: QTBUG-133882
Change-Id: I8aa5f79838aba0b7fb73e1b884c1a1ceb96aec9d
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit fcde54148dc3ea433bdcaaa550676cd0ab368673)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:28 +00:00
Marc Mutz
5deee1e5ab QCssParser: attempt to fix Coverity OVERRUN issue
Coverity complains, for each findKnownValue() call, that "forming the
address of the element at index numValues of buffer start requires the
index to be no more than the number of elements in the buffer", citing
QCss::NumKnownValues (e.g.) as the out-of-bound index.

Since it's complaining about the initialization of `start` in
findKnownValue(), I can only assume that it is bothered by the `+
numValues` (which moves the pointer out of range) followed by the - 1
(which brings it back into range), so make sure we subtract 1 before
adding to `start`.

That array + numValues would be considered outside the array
(incl. one-past-the-end) is highly irregular, and, AFAICT, caused by
the arrays not storing the resp. "unknown" entry at index 0,
effectively turning the arrays into Pascal (base-1) ones.

Shot in the dark (and a sign of poor/overly-strict deduction
capabilities in Coverity, if this is actually fixing the issue), but
worth a try.

Amends previous fix attempt 204b6c99089bcf7893be326e7d0076402b7abf0c.

Pick-to: 6.8 6.5 5.15
Coverity-Id: 183557
Coverity-Id: 183559
Coverity-Id: 183560
Coverity-Id: 183569
Coverity-Id: 183573
Coverity-Id: 183574
Coverity-Id: 183579
Coverity-Id: 183584
Coverity-Id: 183585
Coverity-Id: 183586
Coverity-Id: 183589
Task-number: QTBUG-83817
Change-Id: I3ad1f744986fe3223571a919b8a537c544ef314c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 66081c52b5b4017ae141f8fa27bd082be1e79422)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:28 +00:00
Marc Mutz
97567dee25 Extend tst_QByteArray::replaceWithEmptyNeedleInsertsBeforeEachChar()
Add rows with needles and haystacks whole length is > 1 (to avoid only
hitting paths that use single-char matching).

Amends 5fc1e9fa0c1925654412af5bf46ff95da99bc190.

Pick-to: 6.8 6.5
Reported-by: Ahman Samir <a.samirh78@gmail.com>
Change-Id: Ie4c695f54d84cdb56b93fee6b7224d93faf00f75
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit b83f104889ecf79e9ff0f5724774736bd21416c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:28 +00:00
Marc Mutz
8af957a950 [docs] QString: fix link and formatting in the qPrintable() discussion
The old code used a `<QString>` to indicate an object of QString
type. I have not seen this pattern used elsewhere, so rewrite the
expression to say "call X on the QString" instead of "call
<QString>.X".

Also, the constData() link in the expression ('X' in the previous
paragraph) was unqualified, so resolved to QString::constData(), but
the result of toLocal8Bit() is a QByteArray, and it's thence the link
should point to. Redirect it manually whereever we fell into that
trap.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I2204522351976be0f045bfd60a30c82c9e784dd6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ab1ce95c8ce38683477373cf84ba5686ea00efed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:27 +00:00
Eskil Abrahamsen Blomfeldt
b6dd07382a Mark low-level text classes as security critical
These files process raw end user provided data and
apply structure to it, through layout and Unicode algorithms.

Extra care should be taken when reviewing changes to these
files.

Pick-to: 6.8
Change-Id: Iba86aec1a185bbbcd40aa2b8d4d0d839bb99ba0d
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 2198cdc40630713670064334fb34dc2255980800)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:27 +00:00
Eskil Abrahamsen Blomfeldt
45135e303a Mark font code as security critical
These files process raw font tables from untrusted files.

Pick-to: 6.8
Change-Id: Ie7fbfb667984e2d003b343a2ce011ad0e5aa04d2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 6704e55a9c04014097cc2e90fd75b20ae5da56c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:27 +00:00
Marc Mutz
e1d0213011 QMovableArrayOps::Inserter cleanup [2/3]: mark most data members const
This makes explicit that the only thing that should be changing is
displaceFrom, which tracks the hole-filling process.

Requires rewriting of the dtor a bit, to skip the nInserts
modification.

Pick-to: 6.8 6.5
Change-Id: I1f0ce17cbeb171704f789624ad1be6ef70e58245
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 75df3a250d84a7e2680a8f229d11eec20b2d3ff0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 15:40:22 +00:00
Marc Mutz
431b52d03f QMovableArrayOps::Inserter cleanup [1/3]: inline displace()
Since the ctor is now the only caller of displace(), we can inline the
latter into the former, using ctor-init-list to initialize the
members.

Also fix decltype(bytes) to be size_t, which is what memmove(), the
only user of the value, expects, and ptrdiff_t * sizeof(T) yields
(found by GCC -Wnarrowing complaining).

Pick-to: 6.8 6.5
Change-Id: I3f93e28eebc6deefee8a182eb71a3b0958718ba0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 82d4a81df19fe9aff9d3b1790c2b371a3efc0a99)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 15:40:22 +00:00
Kai Uwe Broulik
9566a199d4 QTabWidget: Guard QTabBar in documentMode
While QTabBar is created by the QTabWidget and therefore doesn't
need to be guarded, QTabBarPrivate::init calls QStyle::styleHint
which might result in QStyleSheetStyle querying properties on
the QTabWidget while its QTabBar isn't assigned yet.

Pick-to: 6.8 6.5
Change-Id: Ic832d3253c5dc54d8d718760c63f34f0b8bde000
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 61c2d3f10124dbf4c6ddb44bc9790431bd389567)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 15:40:21 +00:00
Laszlo Agocs
ec386cd2a9 rhi: vulkan: Double buffer the descriptor sets backing an srb always
This is almost always the case in a typical Quick or Quick 3D rendering
sequence, since there is almost always a uniform buffer, which is almost
always a QRhiBuffer::Dynamic buffer, thus triggering double (or triple,
whatever max_frames_in_flight is) buffering and using multiple
descriptor sets.

This breaks down e.g. when using a compute pipeline and a
texture for imageLoad/store in the srb. If the texture is rebuilt
between frame N and N+1, then in frame N+1 the srb sees that the
descriptor set needs to be rewritten, but that's wrong since frame
N might still be in flight, using that descriptor set.

From now on, pretend that an srb always needs double buffering,
regardless of what kind of resources it references.

Also drop unused code paths. The updateShaderResources function's
argument was never -1, for example, so no point in keeping that logic.

Pick-to: 6.8
Change-Id: If8abb42fd9a2de5aad59ab6ceab3c8086aebae68
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 30dc9ed13fcc2691ed656f6f36d419133856c8cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 15:40:21 +00:00
Laszlo Agocs
7d8b81a491 rhi: gl: Fix an srb tracking issue
Have two pipelines that are used with the same srb:

setPipeline(a);
setShaderResources(s);
draw
setPipeline(b);
setShaderResources(s);
draw

If this is repeated each frame, then on the second an subsequent frames
the uniforms for the program behind pipeline b will not be set,
i.e. the glUniformxx calls will be missing.

This is due to the pipeline's own srb tracking
(currentSrb/currentSrbgeneration) works: in the second frame
setShaderResources(s) for pipeline b will do nothing, since
the command buffer's tracked current srb is already s, and
also b's currentSrb is already s.

The problem remains hidden usually because Quick or Quick 3D
does not generate sequences like the above (same srb with different
pipelines).

Pick-to: 6.8
Change-Id: I56b962f0ba12370e0de7c87fb7178a0b9e4b0178
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit e9fa3e42444faec33a33f4c6ce673f08db2280eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 15:40:21 +00:00
Laszlo Agocs
fb69590c81 rhi: gl: Fix exposing 3D and array textures as load/store images
The expectation, based on what the other backends do, is that all array
layers and 3D texture slices are exposed (i.e., the whole texture).
Same for cubemaps (all six faces), that at least was in place
already.

This is what the odd-named 'layered' argument of glBindImageTexture
controls. Set it accordingly.

Pick-to: 6.8
Change-Id: If6808069dfc9f3df124e508e40abf8c3423289da
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 25394fab9a3a501311601e45af310b3949dff2c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 15:40:21 +00:00
Laszlo Agocs
ffc55b734d Add trusted content notes to QOpenGLShader(Program)
Pick-to: 6.8
Change-Id: I089044e6834ebbb992b36c898eb956959f430522
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit f9a625eb8c774643a8e8a5ff9548634e34bf4fe0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 15:40:21 +00:00
Laszlo Agocs
8dbeacbb5c rhi: gl: Specify 3D textures with mipmaps correctly
When used with load/store, it is already correct due to using
glTexStorage3D. On the other code path however, individually
calling glTexImage3D for all the mip levels requires adjusting
the depth for each level, as it is done for width and height.

Pick-to: 6.8
Change-Id: I440cc10303687b686d78da4c614da4325840803a
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit efc911aa58195d2538be7b0343154038f3a2c3b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 15:40:20 +00:00
Laszlo Agocs
982483f134 rhi: Add doc notes about security considerations
Pick-to: 6.8
Change-Id: Iee3ef375a5f08a0bac5fed2b45ff1d7a3b146dc5
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 8612bd8345deb77a5670d774abfc73479107faf5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 15:40:20 +00:00