Commit Graph

71663 Commits

Author SHA1 Message Date
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 ada885dfd5)
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 ca4774131b.

Pick-to: 6.8
Task-number: QTBUG-100536
Change-Id: I31e124962e03b8b40df9153b09f627e8e22a8119
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
(cherry picked from commit db6f8821fc)
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. 5d8f815e10.

Pick-to: 6.8 6.5
Change-Id: I336f850a586fd2fde8f62c65223f547402fbaa75
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 67e9e2a7e2)
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 d3117e9701.

Pick-to: 6.8 6.5
Change-Id: I0b6aaef6de839f29e0671d382d4555f8ab0afe47
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7bec2f6b42)
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 9684691d51)
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 523973f16b)
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 5157ce7c59)
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 b35ea9b974)
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 41c47fdd19)
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 1b8d085322)
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 f18e8cebfc)
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 c1fba2d4ee)
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 cbd2f56c14.

Pick-to: 6.9.0
Change-Id: I3557eba1990b684a35ab70f95e7f8ccf33850537
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit df96b28f65)
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 d8f6425fef.

Pick-to: 6.8
Change-Id: Ia52a2ec2c079f515f92b0890e42669d4ba435c20
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit 8761fa5b8b)
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 1d2dda041a)
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 455e0ff42a)
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 fcde54148d)
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 204b6c9908.

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 66081c52b5)
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 5fc1e9fa0c.

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 b83f104889)
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 ab1ce95c8c)
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 2198cdc406)
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 6704e55a9c)
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 75df3a250d)
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 82d4a81df1)
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 61c2d3f101)
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 30dc9ed13f)
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 e9fa3e4244)
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 25394fab9a)
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 f9a625eb8c)
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 efc911aa58)
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 8612bd8345)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 15:40:20 +00:00
Joerg Bornemann 7138834c91 CMake: Fix permissions of qt-internal-(strip|ninja).bat.in on Unices
These files should not have executable permissions.

Fixes: QTBUG-125534
Change-Id: I893d4d373ee098864b64200dc6c88b57d05d6209
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit ba103a6fee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 10:18:09 +00:00
Marc Mutz 93c37162af Simplify QLocale::formattedDataSize()
- Introduce symbolic constants for the magic numbers 3 (= log10(base))
  and 10 (= log2(base)).

- Add and use QtPrivate::log2i() instead of manual bit fiddling. This
  makes the two cases nicely symmetric now.

Amends 9d23aebb27.

Pick-to: 6.8 6.5
Coverity-Id: 474294
Change-Id: I657f34878bc3a9b67b03a4d014b91e6d4de31e13
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 9fee7cdfcc)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2025-03-11 10:18:09 +00:00
Cristian Le 477e9216f3 Make RunCMake compatible with CMake<3.18
Avoid using `cmake_language`.

Reverting commit:
67f97f5478

Pick-to: 6.8
Change-Id: I8311508c904cbc66aa663a0b62f861b7b056b526
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 3617409325)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 10:18:08 +00:00
Marc Mutz 2886996de4 Don't leak memory when tst_QOpenGL::fboTextureOwnership() fails
Hold 'fbo' in a (const) unique_ptr instead of a raw pointer, so it is
deleted even if a following QVERIFY/QCOMPARE fails.

This shows that the leak (cf. QTBUG-134557) is not due to the test
itself.

Amends dcbb16a452.

Pick-to: 6.8 6.5 5.15
Task-number: QTBUG-134557
Change-Id: I2f854d5ff036b7ca5e51d2e9ecb1d04bf7a39a61
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit b615c477f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 10:18:08 +00:00
Marc Mutz b2feff382d tst_QOpenGL: don't leak 1399341 byte(s) [...] in 1439 allocation(s)
That's what asan reported for a run of this test executable.

Create `ctx` on the stack instead of the heap to fix the leaks.
For `fbo`, use a std::optional.

After these fixes, the test still leaks 64 bytes in 2
allocations. These seem to be QOpenGLSharedResourceGuards in a
QOpenGLFramebufferObject. Created QTBUG-134557 to track the issue.

Amends
- 68974d8e64 (fboHandleNulledAfterContextDestroyed())
- bb760d9514 (bufferMapRange()/bufferCreate())
- 0541516907 (vaoCreate())

Pick-to: 6.8 6.5 5.15
Task-number: QTBUG-134557
Change-Id: Icc318cd76b9f3ddf71bc294cb96d88485c42d7bc
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 7a1cd692e0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 10:18:08 +00:00
Tim Blechmann b7ec18cfdb cmake: don't pass ftemplate-depth with clang-cl
clang-cl does not support -ftemplate-depth. so we should not pass it
when MSVC is defined.

Pick-to: 6.8
Change-Id: I7f411187c476fa275b677f96a19f782262dc4545
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 39015c049b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 10:18:08 +00:00
Lauri Pohjanheimo 935d1d633c QRhi test renderToTextureArrayOfTexturedQuad unblacklisted
On CI an Android emulator with SwiftShader software graphics
implementation is used. SwiftShader implementation is unable
to emulate this OpenGL functionality.

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

Task-number: QTQAINFRA-6330
Pick-to: 6.8
Change-Id: Ib0832f35b63540d57a273fc6dba1e310de917439
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-03-11 12:18:08 +02:00
Christian Ehrlicher 6f4ddfaef3 QFusionStyle: Disable SH_EtchDisabledText
SH_EtchDisabledText is not widely used in fusion style and where it is
used it
 - does not make any real difference for light mode
 - makes the text look like one missed the glasses

Therefore disable this hint for fusion.

Pick-to: 6.8
Fixes: QTBUG-134533
Change-Id: I42fc20349603cf610ee725802f1095008eafd183
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit c8338d8e77)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 05:12:51 +00:00
Tim Blechmann 246c644622 unreachable: silence warning with clang-cl
clang-cl does not warn about return after unreachable, but would warn
about the unused variable after return.

Pick-to: 6.8
Change-Id: Ia0fcff4f536d51d56eb915a9130cc3f72437d8d1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1bdf5059ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-10 11:13:59 +00:00
Marc Mutz 7ee176bcbe QUnicodeTools: reduce unneeded relocations
Turn the charAttributeFunction array of function pointers into a
switch. This has two benefits:

- The compiler now warns when we introduce a new QChar::Script value
  and statically forces us to think whether a new attribute handling
  function is needed.

- A table of function pointers requires relocations. A switch might
  not. GCC uses a jump table to implement this switch, jumping to
  distinct lea instructions fetching distinct function pointer values,
  and thereby removes relocations, while Clang actually forms a
  function pointer table and turns the switch into an indexing
  operation (with compiler-generated guards). I didn't check whether
  Clang's table actually requires relocations, relinfo.pl doesn't
  report any reductions, but it's become unreliable over the years,
  because it doesn't for GCC, either.

Difference:
  qunicodetools.cpp.o:
- 0000000000000000 l     O .data.rel.ro.local     0000000000000108 QUnicodeTools::Tailored::charAttributeFunction
  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.

Instead of collapsing identical return statements from adjacent case
statements into one, keep the per-case return statements for now, to
aid review, and clean up in a follow-up commit.

Amends dd7d8304bb.

Pick-to: 6.8 6.5
Task-number: QTBUG-100536
Change-Id: Ic5b6bd29e3a3a88f0d194fa7d76272a4770b9840
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 74765ebe65)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-10 11:13:59 +00:00
Marc Mutz b173da88f4 QMovableArrayOps::Inserter: move the displace() call into the ctor
Coverity complained that ~Inserter() will access at least displaceFrom
and displaceTo uninitialized, which is correct, if none of the
insert() overloads have been called in-between. This is a brittle
construct, even though, currently, all users of the class comply.

To help Coverity (and other readers of the code) understand what's
going on, move the displace() call that creates the hole in the
container which the insert() overloads then fill from said overloads
into the ctor, original-RAII style (ctor acquires the hole, dtor closes
it, if needed). This means all fields are initialized in the ctor now.

This is safe, as displace() cannot fail by itself (just a memmove()),
but requires moving the (pos, n) (= hole) information into the ctor
instead. The displace() call in the insert() overloads now becomes a
read of its return argument, displaceFrom.

(Incidentally, that shows that we have maintained the same pointer
twice in the insert overloads, something we'll clean up in a
follow-up.)

In order to verify the insert() post-condition (ie. that we filled the
whole hole created by the ctor, or threw an exception trying),
continue to pass the count to insert().

As a drive-by, rename the insert()-overloads to insertRange() and
insertFill() to match the existing insertOne() function, and to better
express what their purpose is.

Pick-to: 6.8 6.5
Coverity-Id: 378364
Coverity-Id: 378461
Coverity-Id: 378343
Change-Id: I1a6bc1ea0e5506d473f6089818797b02d09ba13e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit aa8e8ffd32)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-10 11:13:59 +00:00
Lauri Pohjanheimo e37e3d9045 Unblacklist tst_QRhi::RenderToFloatTexture and skip on Android-Sim
On CI an Android emulator with SwiftShader software graphics
implementation is used. SwiftShader implementation is unable
to emulate this OpenGL functionality.

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

Task-number: QTQAINFRA-6332
Pick-to: 6.8
Change-Id: I241a2c6772291795d26b9c2a563f4f9412605cf6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-03-10 07:52:42 +00:00
Thiago Macieira 8e94b67ba1 CBOR/JSON: fix crash when comparing strings with different length
Amends 8e5ce9cd36, which introduced the
QtPrivate::equalStrings() call. At that time, equalStrings() had already
required equal lengths (see 1560e0161a),
so no excuse.

[ChangeLog][QtCore][QCborMap and QJsonObject] Fixed bug that could
result in a crash or failing to find a entry in the map/object with non-
ASCII keys.

Manual conflict resolution for 6.9:
- Port from keyView() to key(), because the former is a 6.10+ feature.

Pick-to: 6.8
Fixes: QTBUG-133744
Change-Id: I6b0f8b0a2e47d3ef905afffda6c4c079814a0914
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 54daec43a0)
2025-03-10 08:52:41 +01:00
Giuseppe D'Angelo 8181c4868a Disable -Werror=tsan on GCC < 15
QGlobalStatic has a warning suppression for -Wtsan because of its
usage of std::atomic_thread_fence, which TSAN doesn't support.
That header is included in QtCore's PCH, and that triggers a GCC bug
that causes the warning to be emitted despite the suppression [1].

In a developer build, the warning turns fatal.

We could either disable PCHs in such a build configuration
(TSAN+developer-build+GCC < 15), or: simply make the warning non-fatal
on earlier compiler versions.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64117

Pick-to: 6.8 6.5
Fixes: QTBUG-134415
Change-Id: If80a4acdb1372d00804a60361f6c3d6893b96106
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit a72077a889)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-10 07:52:41 +00:00
Eskil Abrahamsen Blomfeldt d7127c02ff windows: Fix rendering monochrome glyphs in color fonts
If we encounter a normal, monochrome glyph in a color font, we
go via the normal glyph rendering code path. But since we are
drawing into a color-capable glyph cache, we need to make sure
the image we draw has an alpha channel.

This was inadvertedly broken by the refactoring in
1b85143d21, causing black
backgrounds on all such glyphs. Since the default font in Qt Creator
is a color font, it was noticed when upgrading this to 6.9.

Fixes: QTBUG-134473
Change-Id: Iee7eb73a5727324e2ff3bacc2d9ae45cb64fd0b9
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
(cherry picked from commit 54555755f8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 81bbbc3fc4)
2025-03-10 07:52:41 +00:00
Juha Vuolle 7ad9a2d391 qtwasmserver to serve assets from the provided path parameter
qtwasmserver accepts a positional path argument which tells where to
serve the assets from. The argument wasn't actually used, and this
resulted in always using the cwd.

In addition add a check for the path directory existence. Otherwise
this becomes only visible as a 404 Not Found error.

Amends: 156e5c8b69

Fixes: QTBUG-134393
Change-Id: Iacfafe8a2fb2409169b09a17dbc9ffed0ad16fdf
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit fcada7c5c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-10 07:52:41 +00:00
Tim Blechmann aca60117ee QWindows11Style: fix clang-cl warnings
QRect QRect rect and tableView are not used and clang-cl warns about
that.

Pick-to: 6.8
Change-Id: I35ae933b437952c6748e4b09d139cc06c9ce33cb
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 1d83bffb29)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-10 04:53:49 +00:00
Thiago Macieira 87c790851e tst_Q*Application: avoid race conditions during exitFromThread
Amends commit bfbd1a281d. I've noticed
this on my Mac, because the main thread crashed at the same time as the
exitFromThread() thread was exiting and was running ~QLibraryStore:

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x106)
  * frame #0: 0x00007ff8020533be libobjc.A.dylib`getMethodNoSuper_nolock(objc_class*, objc_selector*) + 47
...
    frame #19: 0x0000000103839694 QtCore`QCoreApplication::exec() at qcoreapplication.cpp:1454:32
    frame #20: 0x0000000101fc94ea QtGui`QGuiApplication::exec() at qguiapplication.cpp:1993:12
    frame #21: 0x0000000100004b59 apphelper`exitFromThread(argc=1, argv=0x00007ff7bfeff318) at apphelper.cpp:50:5
  thread #8, name = 'QThread'
...
    frame #11: 0x00007ff8020c4f94 dyld`dyld4::APIs::dlclose(void*) + 178
    frame #12: 0x0000000103e82476 QtCore`QLibraryPrivate::unload_sys(this=0x0000600001254160) at qlibrary_unix.cpp:252:24
    frame #13: 0x0000000103e793fc QtCore`QLibraryPrivate::unload(this=0x0000600001254160, flag=UnloadSys) at qlibrary.cpp:561:36
    frame #14: 0x00000001039740c8 QtCore`QFactoryLoader::~QFactoryLoader(this=0x00000001029e5e70) at qfactoryloader.cpp:438:21
    frame #15: 0x00000001039745e9 QtCore`QFactoryLoader::~QFactoryLoader(this=0x00000001029e5e70) at qfactoryloader.cpp:425:1
    frame #16: 0x0000000101eb723c QtGui`void std::__1::__destroy_at[abi:sn180100]<QFactoryLoader, 0>(__loc=0x00000001029e5e70) at construct_at.h:67:11
    frame #17: 0x0000000101eb7209 QtGui`void std::__1::destroy_at[abi:sn180100]<QFactoryLoader, 0>(__loc=0x00000001029e5e70) at construct_at.h💯3
    frame #18: 0x0000000102046762 QtGui`QtGlobalStatic::Storage<QFactoryLoader, (anonymous namespace)::Q_QGS_piLoader>::destroyYourself(nextState=Destroyed) at qglobalstatic.h:61:9
    frame #19: 0x0000000102046736 QtGui`QtGlobalStatic::Holder<(anonymous namespace)::Q_QGS_piLoader, (anonymous namespace)::Q_QGS_piLoader>::~Holder(this=0x00000001029e5e61) at qglobalstatic.h:83:9
    frame #20: 0x00000001020465d9 QtGui`QtGlobalStatic::Holder<(anonymous namespace)::Q_QGS_piLoader, (anonymous namespace)::Q_QGS_piLoader>::~Holder(this=0x00000001029e5e61) at qglobalstatic.h:82:5
    frame #21: 0x00007ff8022f4231 libsystem_c.dylib`__cxa_finalize_ranges + 402
    frame #22: 0x00007ff8022f4052 libsystem_c.dylib`exit + 35
    frame #23: 0x000000010000755a apphelper`exitFromThread(int, char**)::$_1::operator()(this=0x000060000175612c) const at apphelper.cpp:47:9

Pick-to: 6.9.0 6.8
Change-Id: Ib1c72c7975b247cc2d17fffd6c5de89a95c22dad
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit e6a6757c14)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-10 00:14:29 +00:00