65727 Commits

Author SHA1 Message Date
Mårten Nordheim
b099988f6d QStringConverter: add a test for missing drain
Task-number: QTBUG-118834
Change-Id: I3085e6f83aa5a21f477a101a45186d0ce2133d10
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-02-12 19:12:25 +01:00
Mårten Nordheim
496340f33a QLocal8Bit::convertFromUnicode[win]: support more than 2Gi input
As we did for convertToUnicode. To support more than 2Gi input, we
need to handle the input in chunks because of the `int` parameter in the
Windows API. Testing also revealed some corner cases we also need to
handle, which is mostly happening when there is an incomplete surrogate
pair at the end of the current input window.

The test takes between 3 (plain MinGW) and 8 (MSVC with ASAN) seconds
to run on my machine.

Pick-to: 6.7 6.6 6.5
Fixes: QTBUG-105105
Change-Id: I4fb0420b88ca41dfa8b561a35c6d96659bd81468
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-02-12 19:12:25 +01:00
Mårten Nordheim
cba0efc270 QLocal8Bit::convertFromUnicode[win]: Pre 2Gi changes
As we did for convertToUnicode, we do some smaller changes, like
increasing indentation, and switching to using pointers and calculating
the input-size in this commit, so that the real changes in the next
commit are (hopefully) easier to read.

Pick-to: 6.7 6.6 6.5
Task-number: QTBUG-105105
Change-Id: I3bf1a487f63a3e24efd7a945152647dd8fc0aca8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-02-12 19:12:25 +01:00
Mårten Nordheim
a7171c6256 QLocal8Bit::convertToUnicode[win]: support more than 2Gi input
To properly support more than 2Gi input we have to support being asked
to resize more than once. Previously we would only have to resize the
one time because we went from our 4K stack buffer to the final size
heap buffer. But now, since our input size can only be specified in
int, we have to deal with looping over the input and resizing the buffer
as needed.

We also have to deal with trailing data at the end of our sliding window
potentially causing issues for the encoding. So we try to shrink our
window when it causes issues, or store the trailing data for the next
call.

The >2Gi test takes about 6-8 seconds on my machine.

Pick-to: 6.7 6.6 6.5
Task-number: QTBUG-105105
Change-Id: I9a44b8f379bf2c2c58183f961544ed2f4c8c7215
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-02-12 19:12:25 +01:00
Mårten Nordheim
1090d5dd4a QLocal8Bit::convertToUnicode[win]: split out buffer growing
We will need to potentially grow the buffer before appending anything
to it, because if we pass in 0 as a size then the MultiByteToWideChar
just returns the size we would need. If we didn't intend to do so then
we would increment our output buffers even though nothing is written.

And when appending single characters (like the replacement character
for an invalid sequence) we need to grow the buffer as well.

We'll need this all in the next commit.

Pick-to: 6.7 6.6 6.5
Task-number: QTBUG-105105
Change-Id: I94b9a0f7d18a725da01a47398163e6d0f704eefc
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-02-12 19:12:25 +01:00
Marc Mutz
c9b967437d Add fast-path in QLibraryStore::findOrCreate() for !instance()
If there's no QLibraryStore::instance(), then there's no LibraryMap,
so no need to construct a mapName we know we'll just throw away.

We must keep locking the qt_library_mutex to check instance(), but we
can drop it immediately if we find there isn't, and construct the
QLibraryPrivate object outside the critical section (the hope is that
the compiler sees this as an opportunity to tail-call).

The final goal of this exercise is to get rid of the double-lookup in
LibraryMap.

Pick-to: 6.7 6.6 6.5
Change-Id: I181dd2657e831a37e2d6f1c5d4df7e2a25ac48cd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-12 17:52:58 +01:00
Marc Mutz
7862453ba9 QTzTimeZoneCache: make findEntry() static
It doesn't need access to the members, so making it static both saves
the implicit this pointer, and communicates to the reader that this is
function doesn't access other QTzTimeZoneCache members.

In particular, it proves that it doesn't really need to be called with
m_mutex locked, cf. QTBUG-122138.

Task-number: QTBUG-122138
Pick-to: 6.7 6.6 6.5
Change-Id: I28c99be8d066c1647aaf7aa256b6400a6dd92955
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-12 17:52:58 +01:00
Tor Arne Vestbø
4e9017c1fc Un-blacklist tst_QWidget::optimizedResizeMove on macOS
It has been passing consistently in dev, 6.7, 6.6, and 6.5 for the past
6 months: http://testresults.qt.io/grafana/goto/S35hM52IR

As a drive-by, fix comment that claims the test is only run on macOS.

Pick-to: 6.7 6.6 6.5
Change-Id: I6502c40e0c39afb68a461bd530df1bacb5211dec
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2024-02-12 17:52:58 +01:00
Edward Welbourne
7c502391cf Implement QTZP::isTimeZoneIdAvailable() on Android
The QTZP base implementation of the availability check was to
construct the list of all available IDs, then see whether the given ID
appears in it. This can be very inefficient. The ICU backend has
recently grown a more efficient solution than that, matching the TZ
and Darwin backends. For Android this was still very inefficient, but
its instantiation is cheaper, so simply instantiate and see if the
result is valid. For MS, the backend caches the list of available
zones, so searching the list is a reasonable solution, given the
complexity of its constructor.

Add an implementation for Android and document, in the base-class,
that the fall-back is only suitable for use if the list is cached.

Pick-to: 6.7 6.6 6.5
Change-Id: I9dc2ba4be1492ec811c8db6cff9490ac0303115d
Reviewed-by: Volker Krause <vkrause@kde.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-02-12 17:52:58 +01:00
Alexey Edelev
721641d38c Add the missing versioned alias for the GlobalConfigPrivate target
The build tree versioned alias is missing for the GlobalConfigPrivate
target.

Change-Id: I42e9f63363be472e661b656f665e29ea894b7e33
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-02-12 10:29:03 +01:00
Tinja Paavoseppä
0ae95cb1f7 Android: Remove unused QtLayout.TouchListener
Now that QtWindow extends QtLayout again, the touch listener interface
is unused as QtWindow can directly handle the touch events.

Pick-to: 6.7
Change-Id: Ic58b5ab7644ffb3a60833b6507115b20db3f29de
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-02-12 08:51:01 +02:00
Tinja Paavoseppä
46c2d587b0 Android: Change QtWindow Runnables to lambdas
Pick-to: 6.7
Change-Id: I19a3e0a0a035a49965d7643db3ebdb72de95a3a9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-02-12 08:50:59 +02:00
Tinja Paavoseppä
1f2570976e Android: Make QtWindow package private
Pick-to: 6.7
Change-Id: I0231193c3118619b4d2fc9f4e7f0f85ddd0b41b8
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-02-12 08:50:57 +02:00
Tinja Paavoseppä
3914a965cc Android: Move bringChildToFront() call to Android UI thread
Cannot change view hierarchy outside of Android UI thread.

Task-number: QTBUG-116187
Pick-to: 6.7
Change-Id: I05d36a28d16480519a6919047272be9f3cf667d0
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-02-12 08:50:55 +02:00
Tinja Paavoseppä
3dad99a43e Revert "Android: Make QtWindow wrap the QtLayout instead of inherit it"
This reverts commit 2bc7d38bd63843c4598ed501e3adbf0e39162c61.
The real cause for the problems was the missing runAction() in
bringChildToFront(), creating the QtLayout could still be done
in Qt thread without problems, just as long as its hierarchy
is not changed outside of Android UI thread.

Let QtWindow extend QtLayout again - the missing runAction()
causing problems is added back in a follow up commit.

Task-number: QTBUG-116187
Pick-to: 6.7
Change-Id: Ib4211c40adf573f9f6dd6300b275cff0ce718fba
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-02-12 08:50:53 +02:00
Tim Blechmann
84537e6dc2 qmake: use [[fallthrough]]
Since qt is on C++17, it's possible too use the [[fallthrough]]
attribute instead of a // Fallthrough comment, that may be stripped by
compiler launchers (ccache/icecc), causing -Wimplicit-fallthrough
warnings.

Pick-to: 6.7
Change-Id: Ic809cf4e95b2160fac591b3802fa123e705337cc
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-02-12 03:01:48 +00:00
Thiago Macieira
b911bb0d42 qsimd_p.h: move the ARM Crypto (AES) disabling on Linux
Commit 8179d7edf6cb2b06666634d0cafddbca974931e1 added the check in two
places. Move to a central one, disabling the bits in
qCompilerCpuFeatures.

Change-Id: I50e2158aeade4256ad1dfffd17b117afcb93c126
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-02-10 21:39:45 -08:00
Thiago Macieira
6ab4623cad qHash: force inlining of the hash16bytes() helper
It wasn't getting inlined in aeshash256_lt32_avx256() (used by VAES +
AVX512VL variant) due to a GCC __attribute__((target())) mismatch,
causing a major loss of performance compared to the VAES + AVX2 variant.

Comparing the throughput after this fix on an Intel Core i7-1165G7
(Tiger Lake) laptop, with qHashBits modified to statically select either
[A] aeshash256() or [B] aeshash256_avx256(), out of 5 runs:

            dictionary   numbers     paths-small  uuids      longstrings
A/B (avg)   103.7%       101.1%      103.5%       104.5%     100.3%
A/B (best)  103.4%       100.9%      103.2%       103.6%     100.8%

Considering that a string representation of a UUID is 37 characters (74
bytes), neither "uuids" nor "longstrings" are directly affected by this
change. However, the overhead does change, with the aeshash256_avx256()
needing slightly fewer instructions to reach aeshash256_ge32().

Benchmarking on an Intel Xeon Scalable 4th Generation (Sapphire Rapids),
the "uuids" data set has a 10% performance loss for some reason.

Pick-to: 6.5 6.6 6.7
Change-Id: I50e2158aeade4256ad1dfffd17b1b105d3cab482
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-02-10 21:39:31 -08:00
Volker Hilsheimer
a8c04721af Add virtual QObjectPrivate::writeToDebugStream
QObject by default writes class- and objectName to the debug stream,
but QObject subclasses might want to write different, or additional
information. Providing class-specific debug stream operators is not a
good solution for this, as it doesn't respect runtime polymorphism.

With a virtual helper in QObjectPrivate, class authors can add an
override.

Change-Id: I382126ae5a56391d0c7e5ccb58fbbafa6aab5c77
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-02-10 22:07:56 +01:00
Thiago Macieira
2c51a0bb7b QDBusAdaptors/Doc: fix missing preposition "in" in documentation
Drive-by clarify a bit the text what "it" means, because it's different
from the "it" in "its" two words later.

Fixes: QTBUG-121875
Pick-to: 6.6 6.7
Change-Id: I664b9f014ffc48cbb49bfffd17b0959e7b3495fd
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2024-02-10 02:39:14 -08:00
Thiago Macieira
f3832b63de QtSql: #include mocs
Pick-to: 6.7
Change-Id: I50e2158aeade4256ad1dfffd17b1f286a9001ae8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-02-10 02:39:14 -08:00
Giuseppe D'Angelo
f221ac04c5 QPixelLayout: remove explicit array sizes
For qPixelLayouts, there's a static_assert right below it that checks
that the array has a specific size, as a guard for extending
QImage::NImageFormats without also extending the array. Giving an
explicit size to qPixelLayouts defeats the entire purpose.

For the other arrays of function pointers, drop the sizing and add the
missing static_asserts.

Use std::size as a drive-by.

This work has been kindly sponsored by the QGIS project
(https://qgis.org/).

Change-Id: Ic791a706a8ae964e3aee482f23b7eeeedf97bdc6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-02-10 10:19:21 +01:00
Giuseppe D'Angelo
7dec8f74a0 QPdfWriter: doc fix
When switching the default to Auto, forgot to also fix the
corresponding method documentation.

Change-Id: I4169680b6833a2ea381d950a3a7fad005c14bc71
Reviewed-by: Albert Astals Cid <aacid@kde.org>
2024-02-10 08:49:17 +01:00
Tim Blechmann
72f5793d2e qmake: make unity-buildable
msvc_objectmodel.cpp and qmakeparser.cpp have symbols that may clash.
Removing them from unity builds allows qmake to be unity-built.

Pick-to: 6.7 6.6 6.5
Change-Id: I46443ec979142ab2ebb686f9444b37e1043f0af1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-02-10 03:08:19 +00:00
Volker Hilsheimer
a86321cb66 QTreeView: fix performance regression from accessibility updates
When expanding items in a tree view, the model as seen by accessibility
changes size and structure, and needs to be reset. This was done in
6a4afebc5ce8db69a6c9fb398cada31e6bad5e3c by emitting a ModelReset update
at the end of QTreeViewPrivate::layout when laying out the items had
changed the number of visible items.

However, QTreeViewPrivate::layout is called both recursively, and in a
loop when expanding all items, or expanding items to a certain depth,
resulting in a heavy performance hit when each recursion or iteration
causes the accessibility bridge to rebuild its representation from
scratch.

Instead, we now only store a flag that the model has to be reset in
QTreeViewPrivate::layout, and then trigger the reset in the function
that call layout, after the laying out is complete.

Fixes: QTBUG-122054
Pick-to: 6.7 6.6
Change-Id: Icb8384b56a4727c8c5050a1d501aebb55f48aafe
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-02-09 23:16:39 +01:00
Christian Ehrlicher
16c27a83f0 SQL/ODBC: Remove code duplication - merge SQLFetch/SQLFetchScroll
... into an own function instead doing the check if fetchScroll is
available in every function.

Pick-to: 6.7
Change-Id: I8c8a1c8693f667ddf89a660b733e31505427073a
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2024-02-09 23:16:39 +01:00
Christian Ehrlicher
06039b523d SQL/ODBC: avoid code duplication
... by moving the adjustment for the table/schema/catalog name into
splitTableQualifier().

Pick-to: 6.7
Change-Id: Ia392b1c2e7f29e63ea88c21492f2116eac573b5e
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2024-02-09 23:16:38 +01:00
Christian Ehrlicher
686f953bdb SQL/ODBC: remove unneeded qMakeFieldInfo(... QString *errMsg)
This function can be merged with the other overload of qMakeFieldInfo()
because no-one uses it except qMakeFieldInfo() itself.

Pick-to: 6.7
Change-Id: I7ed07ac0c673801fed9c00c9b0ce1628cfea3837
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2024-02-09 23:16:38 +01:00
Alexey Edelev
d2f7015184 Introduce NO_GENERATE_CPP_EXPORTS argument for qt_internal_add_module
The argument is inverted GENERATE_CPP_EXPORTS argument. Use it
explicitly for the modules that do not require the autogenerated cpp
exports.

Task-number: QTBUG-90492
Change-Id: Ic67772ba9ed5e40f132a97e7d6844102ad023ff3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-02-09 23:00:04 +01:00
Marc Mutz
1a7edf3ba7 Add q20::erase_if(std::(multi)map, pred)
INTEGRITY has a pre-P1115 implementation of std::erase/erase_if that
returns void instead of the number of erased elements, so make q20's
implementation more specialized, so the compiler will pick it over
INTEGRITY's.

Same as 9b83574e8391e3e68a1c400f09b8354e268eeb32 did for std::vector.

Pick-to: 6.7
Change-Id: I65149d7c92593126696f281151309b8f02ba4038
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-02-09 20:33:05 +00:00
Marc Mutz
e1f45ad818 QMap: add missing qHash() overload
Found in API review, but not deemed important enough to still get into
6.7.

Not implementing it for QMultiMap, because there we need to mod out
order of equivalent elements.

The GHS compiler acted up and tried to compile the noexcept
specification, hitting non-existing qHash(QVariant) for QVariantMap
and producing a hard error instead of SFINAE'ing out. As a
work-around, establish an artificial SFINAE-friendly context, but only
for that compiler.

[ChangeLog][QtCore][QMap/QHash] Added qHash() overload for QMap.

Change-Id: Ia7dbf488e8e5490962118e40581b7c4cc8ed95e5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-02-09 20:33:05 +00:00
Marc Mutz
3a2d8c5828 QLoggingRegistry: disable copying
It's not copied, and copying would probably be a bad idea, so make
sure it's not done inadvertently.

Pick-to: 6.7 6.6 6.5
Change-Id: Ia7397906c0efb07ac5e079580bdbb15f4bf4911e
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2024-02-09 21:33:04 +01:00
Ahmad Samir
c2f38c69fc QFileSystemMetaData: use QTRY_COMPARE*(10s)
After d4bb448cddce63e0c6a84a86020fa59dd32b2293 (thanks to Marc), now we
can use chrono literals with QTRY_* macros.

Amends 72f5b35b3d7704db6ef16e4c60751ed8444363be .

(Cannot be backported to older branches because the QTRY* commit is only
in the dev branch).

Change-Id: Ic31d1ee717af604dd762afa44741cf9ea9b33a8e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-02-09 22:33:04 +02:00
Shawn Rutledge
3f515fa7af QtIcoHandler::canRead(): avoid checking more than once
QtIcoHandler::canRead() calls ICOReader::canRead(), which assumes that
QIODevice::pos() is at the position where the .ico data starts (i.e.
pos() == 0 if this is a separate .ico file). But if an AnimatedImage in
Qt Quick opens an .ico file, canRead() gets called multiple times:
the first is when QQuickAnimatedImage::frameCount() eventually results
in QImageReaderPrivate::initHandler(); then ICOReader::readHeader()
is called, which moves the file position. The second time is when
QQuickAnimatedImage calls QMovie::isValid(). At that time,
QIODevice::pos() == 6: we need to avoid calling ICOReader::canRead()
because it's no longer at the start of the data.

Without this change, AnimatedImage reports "Error Reading Animated Image
File" and doesn't show anything.

The fix is to store the known-good state, the same way that
QTiffHandler::canRead() returns true if its d->tiff already exists
(TIFFClientOpen() succeeded).

The test checks that it's ok to call QMovie::frameCount() first and then
QMovie::isValid(). Calling frameCount() has the effect of moving
QIODevice::pos().

Pick-to: 6.5 6.6 6.7
Task-number: QTBUG-117429
Change-Id: Ie3a5225f2cea9a0d76d685e83ce4d4a10cbe9188
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-02-09 12:17:21 -07:00
Ahmad Samir
83f7125ac8 QFileSystemIterator/Unix: use QStringDecoder
The end result is a QFileInfo constructed from the QFileSystemEntry;
QFileSystemEntry's API will at some point convert the NativePath (QBA on
Unix) to a QString, e.g. when it calls findLastSeparator().

So instead of converting the parent dir path from Utf8 to Utf16 multiple
times, store the dir path as a QString once in the constructor.

Use QStringDecoder to convert the dirent->d_name to Utf16 and check the
decoder's hasError(); which as Thiago pointed out, is more efficient
than using isValidUtf8(), throwing away the results, then converting to
unicode anyway later on in QDirIteratorPrivate::advance().

(Ironically) `QFileSystemEntry::NativePath nativePath` is still used on
Windows.

Change-Id: Icd2b130103640b502862d210d64926b99c499a01
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-09 18:44:23 +02:00
Christian Ehrlicher
74722411d3 QSqlQuery: remove unneeded friend tst_QSqlQuery
... as it is no longer needed.

Pick-to: 6.7
Change-Id: Ia60b6e53675260ef0e793ac1b44c913af1454b35
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-02-09 17:12:23 +01:00
Christian Ehrlicher
55d1480c99 SQL/OCI: fix QOCIDriver::formatValue()
The switch needs to be on QSqlField::metaType() instead the internal
QSqlField::typeID() which holds the db-specific type of this field.

This amends 7b391c0d2c03d8d25449eca3868cd010d75ff81e.

Pick-to: 6.7 6.6 6.5 6.2
Change-Id: Id1d1791826f08adb01cc3da45bf5a66bad288046
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2024-02-09 16:12:23 +00:00
Christian Ehrlicher
02a77600e5 QHeaderView: make sectionsMovable/sectionsClickable properties
When those two attributes were added in Qt5 they were not marked as
property for unknown reason. Therefore propagate them now.

Fixes: QTBUG-1639
Change-Id: If9f0def2eb680c9c9e8a04b101768d87885d542b
Reviewed-by: David Faure <david.faure@kdab.com>
2024-02-09 17:12:23 +01:00
Tor Arne Vestbø
41b76ffbd0 Apple: Make Qt::Key_Backspace primary sequence for StandardKey::Backspace
This will show up in menus as ⌫, instead of ^H, which is a better fit
with the native behavior.

Task-number: QTBUG-122042
Task-number: QDS-11733
Pick-to: 6.7 6.6 6.5
Change-Id: I224971421a13baec2a0f65be8ae4a5791dabafdd
Reviewed-by: Doris Verria <doris.verria@qt.io>
2024-02-09 15:26:21 +01:00
Eirik Aavitsland
b0056f052d Refix invalid glTexImage2D operation in FramebufferObject
A recent change fixed the texture format parameter to be RGB instead
of RGBA for opaque internal formats. However, this broke the RGB10
case, since the pixel type is then GL_UNSIGNED_INT_2_10_10_10_REV. The
doc says:

"GL_INVALID_OPERATION is generated if type is [...]
GL_UNSIGNED_INT_2_10_10_10_REV [...] and format is neither GL_RGBA nor
GL_BGRA."
https://registry.khronos.org/OpenGL-Refpages/gl4/html/glTexImage2D.xhtml

This modifies ba9e57d65f15c935632b0ad22db0bead9a7d5f90.

Pick-to: 6.7 6.6 6.5
Change-Id: I9a004331513179a3f840a007af0418d14e7f5dff
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2024-02-09 15:26:21 +01:00
Volker Hilsheimer
a8da9829dc QTest: rename local timeout variable in QTRY_IMPL macro
`timeout` is a likely name for a variable in the scope in which a
QTRY_ macro is used, so don't use that name in the macro itself. The
other variables are all prefixed with `qt_test_`, so do that here as
well, and be explicit about what the variable stores.

Amends d4bb448cddce63e0c6a84a86020fa59dd32b2293.

Task-number: QTBUG-121746
Change-Id: If05dccdc24a66e95a08156b820d185f184783ad6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-02-09 15:11:50 +01:00
Jonas Karlsson
28ecb523ce Improve KTX file reading memory safety
* Use qAddOverflow/qSubOverflow methods for catching additions and
  subtractions with overflow and handle these scenarios when reading the
  file.
* Add 'safeView' method that checks that the byte array view constructed
  is not out of bounds.
* Return error if number of levels is higher than what is reasonable.
* Return error if number of faces is incorrect.
* Add unit test with invalid KTX file previously causing a segmentation
  fault.

This fixes CVE-2024-25580.

Fixes: QTBUG-121918
Pick-to: 6.7 6.6 6.5 6.2 5.15
Change-Id: Ie0824c32a5921de30cf07c1fc1b49a084e6d07b2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-02-09 13:08:44 +01:00
Paul Wicking
a3bc8fc560 Doc: QRhi corrections
* There's no convenience header for the `QRhi` class, so add the
  `\inheaderfile` command to specify the correct include.
* The `QRhi` class belongs to the `QtGuiPrivate` module; use the
  correct name.
* QDoc needs to know about the QtGuiPrivate module. Add basic
  documentation for the private module.

Task-number: QTBUG-121855
Task-number: QTBUG-121991
Change-Id: I1ffd729a5f9c928f4cf91ce7127f40c7733fc42f
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2024-02-09 12:39:28 +01:00
Marc Mutz
b28bad0b20 Add fast-path in QLibraryStore::findOrCreate() for empty fileName
The LibraryMap can never contain an object whose fileName is empty.

To see that, observe that the only insertion into LibraryMap is in
findOrCreate() and that refuses to add such objects there.

But if LibraryMap cannot contain such an object, and findOrCreate({})
is just an ugly way to get a default-constructed QLibraryPrivate (a
new one for each call), then we don't need to lock the
qt_library_mutex to produce one, and neither do we need to construct a
mapName that we know we'll not find, anyway.

So drag this case to before the mutex locking and the construction of
mapName.

It took me more coffee than I'm ready to admit to figure this out, so
leave a comment for the next reader indicating that an empty fileName
is actually a valid argument.

To avoid repeating the new-expression, wrap it in a lambda, together
with the ref() call. Move the remaining ref() call to where it's still
needed.

The final goal of this exercise is to get rid of the double-lookup in
LibraryMap.

Pick-to: 6.7 6.6 6.5
Change-Id: I781eafdb9516410d7a262ad27f52c38ad2742292
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-09 12:39:28 +01:00
Marc Mutz
6675e8c942 QFactoryLoader: cut out the QMap middle-man
In Qt 6, QMap is just a shared pointer to a std::map.

QFactoryLoaderPrivate::keyMap is never copied, though, so the implicit
sharing that QMap adds on top of std::map is useless.

Use the underlying std::map directly.

Yes, the std::map API is a bit raw around the edges (std::pair
value_type), but we're professionals here.

Saves more than 1.7KiB in TEXT size on optimized AMD64 GCC 11 C++20
Linux builds.

As a drive-by, fix the double lookup in updateSinglePath().

Change-Id: I0d59f43d490fb947f653fe8dc903cf7eb9af700a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-02-09 11:39:27 +00:00
Marc Mutz
e3cc87c5f4 QMimeBinaryProvider: cut out the QMap middle-man
In Qt 6, QMap is just a shared pointer to a std::map.

QMimeBinaryProvider::m_mimetypeExtra is never copied, though, so the
implicit sharing that QMap adds on top of std::map is useless.

Use the underlying std::map directly.

Yes, the std::map API is a bit raw around the edges (std::pair
value_type), but we're professionals here.

Saves more than 1.7KiB in TEXT size on optimized AMD64 GCC 11 C++20
Linux builds.

As a drive-by, cut out the insertIt temporary, too, and assign
directly to `it`.

Change-Id: If3fd98a7e7017909d00b8725f8c252b19459d5b6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
2024-02-09 11:39:27 +00:00
Kevin Keating
38c62c5851 WASM builds now handle bitmap and pixmap cursors
[ChangeLog][QtGui][Platform Specific Changes][wasm] Previously, bitmap
and pixmap cursors were nonfunctional in wasm builds and would trigger
warnings.  These cursors now work as expected.

Fixes: QTBUG-116796
Pick-to: 6.5 6.6 6.7
Change-Id: Idd9aa4d458a36452fd5b49f72cc595756fc50923
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2024-02-08 23:55:51 +00:00
Artem Dyomin
1d6bb23f62 Fix loading QRhiTexture from image on gles
The code should consider that image may be created by
a pointer to user data, with original alignments.
It means that we the way of setting parameters from
raw data and QImage should be the same.

In Qt Multimedia we want to pass a zero-copy image
to rhi creation to get rid of an extra copy:
codereview.qt-project.org/c/qt/qtmultimedia/+/537062

Aslo, data align has been fixed.
Due to the documentation, GL_UNPACK_ALIGNMENT can
be 8, 4, 2, 1. Let's find the biggest possible align.

Task-number: QTBUG-121934
Pick-to: 6.7 6.6 6.5
Change-Id: Ic0f1617d4699217a7549c13e916be96108183d03
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2024-02-08 23:41:11 +01:00
Christian Ehrlicher
1d799e9108 QAbstractItemView: close all child editors when parent is removed
QAIV::rowsAboutToBeRemoved() closed all child editors when the child was
a direct ancestor of the removed index but forgot to check if the index
is an indirect ancestor. Some of those editors were removed later in
updateEditorGeometries() but not all as the testcase in the bug report
showed.

Pick-to: 6.7 6.6 6.5
Fixes: QTBUG-103476
Change-Id: I90b3d3bff3857aa79f96eecf23d980928693b7bc
Reviewed-by: David Faure <david.faure@kdab.com>
2024-02-08 18:31:26 +01:00
Marc Mutz
a5f8592639 QVersionNumber: apply LWG 3346 work-around
QtWebEngine builds using GCC 10.2 have hit the GCC < 10.4 problem with
containers that define both element_type and value_type, so lift the
work-around from QList to QVersionNumber, too.

Amends 2188ca2c5df6f21a953c002edbe5b2d2cc2c2d2c.

Fixes: QTBUG-122037
Change-Id: Idb59b5325ab6308cfd7d1a5559e45a01a5802099
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-02-08 17:43:59 +01:00