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 ba9e57d65f.
Pick-to: 6.7 6.6 6.5
Change-Id: I9a004331513179a3f840a007af0418d14e7f5dff
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
`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 d4bb448cdd.
Task-number: QTBUG-121746
Change-Id: If05dccdc24a66e95a08156b820d185f184783ad6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* 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>
* 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>
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>
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>
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>
[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>
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>
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>
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 2188ca2c5d.
Fixes: QTBUG-122037
Change-Id: Idb59b5325ab6308cfd7d1a5559e45a01a5802099
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
We have not hit the GCC < 10.4 problem with containers that define
both element_type and value_type, yet, but we have with
QVersionNumber, so proactively apply it to QSpan, too.
While we're at it, copy the QList code to mark QSpan, too, as
contiguous.
Pick-to: 6.7 6.6
Change-Id: I883fd0b5f75db175a730262035ebbf0cb19de529
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
We'll need this in more places, so centralize its definition in
qcompilerdetection.h.
Amends 595b4e1a9b.
Pick-to: 6.7 6.6 6.5
Change-Id: I87f84cb9ff3ad339c000604423295180176f5799
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Made the code simpler and amended comments. Computing the offset costs
less than computing full data at the given moment, especially when
we're going to ignore the daylight-offset that reports and call
another ICU function for it, if needed. Explain why the result is
unreliable and why, when that matters, we probably came via a
different code path that gets it right. Note the potential
inconsistency in locale between the UCalendar's construction and the
request for localized display name.
Change-Id: I2203c0bb053fa0e658373e4a818b77739be50a23
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The new rules were added in Unicode 15.1 (TR #14, revision 51).
The rules read:
LB15a: (sot | BK | CR | LF | NL | OP | QU | GL | SP | ZW)
[\p{Pi}&QU] SP* ×
LB15b: × [\p{Pf}&QU] (SP | GL | WJ | CL | QU | CP | EX
| IS | SY | BK | CR | LF | NL | ZW | eot)
Add two new line breaking classes LineBreak_QU_Pi and _QU_Pf to
represent quotation characters with context that matches left
side of LB15a and right side of LB15b respectively. This way
it is still possible to use the line breaking classes table.
Also add a coment about the original source of the line
break table.
Task-number: QTBUG-121529
Change-Id: Ib35f400e39e76819cd1c3299691f7b040ea37178
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Unicode 15.1 (more spcifically UTS #46, revision 31) changes how
host names are processed. The initial Unicode host name mapping
is done without validity checking. That check was used in the past
to mark QUrl's invalid. This patch inserts simplified validity
check later. This check is similar to one performed before
conversion to unicode, but does not include BiDi check to keep
names starting with xn-- valid.
Additional complication is that U+1E9E LATIN CAPITAL LETTER SHARP S
must be mapped to "ss" with transitional processing.
It is not possible anymore to predict whether Qt implementation
considers a URL valid by using only error codes in the tests
vectors file. The test was adjusted to expect an empty string
(indicating invalid QUrl) or string matching the entry in vectors
file if there are any processing errors specified for that entry.
Unblacklist tst_QUrlUts46::idnaTestV2.
Task-number: QTBUG-121529
Change-Id: Iad5dadd1a6695fa54b432e35000b350cd6e06341
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Add enumerator for the new Unicode version to QChar::UnicodeVersion.
Remap new line breaking classes to their Unicode 15.0 values:
* AK, AP and AS to AL,
* VI and VF to CM.
These are classes for new line breaking support for Indic scripts
that require more work.
Blacklist failing tests for now:
* tst_QUrlUts46::idnaTestV2
* tst_QTextBoundaryFinder::lineBoundariesDefault
* tst_QTextBoundaryFinder::graphemeBoundariesDefault
Regenerate the source files.
Task-number: QTBUG-121529
Change-Id: I869cc9fbaa53765d8ae6265c22cdbef9f19d05bf
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
QL1SV is what QNetworkReply::rawHeader() ingests, and also it's what
QHttpHeaders::nameAt() returns.
Pick-to: 6.7
Change-Id: I967416cf6f203fe0f0980ef7eae2de7efc6d5377
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
HTTP header name fields are case-insensitive and the QHttpHeaders class
stores them as lower-case. Therefore the case-insensitive comparisons,
when comparing against a lower-case value, are not needed.
Pick-to: 6.7
Change-Id: I7f38ef16aa7c61103abc4c81c13aebdd6e535dc8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
... as a more computationally effective way, which was not present at
the time those usages were introduced.
As a drive-by add spaces around a binary operator
Task-number: QTBUG-122017
Pick-to: 6.7
Change-Id: I0528c995d1a3c1fe171486c5c313697d1706ee10
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit makes it so the QRhiD3D12::activeAdapter is set when
using an imported device. QD3D12MemoryAllocator::create would
crash before as it would attempt to call IDXGIAdapter1::GetDesc1
on the passed uninitalized pointer. With this change using an
imported device with the d3d12 rhi backend will no longer crash
the application.
Fixes: QTBUG-122007
Pick-to: 6.7 6.6
Change-Id: Iadc67fee0c7ee70ac904f66a523acd3b1a63e42b
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This patch has several different goals:
- Make the QDom classes easier to use through PySide6 by avoiding the
the generation of variable names that have no meaning.
- Make the code cleaner as using unrelated single letter parameter is
not the best way to convey the information.
- Improve the documentation.
- Make qdoc's work easier
Fixes: QTBUG-121670
Task-number: QTBUG-121468
Change-Id: Ia31d119b3a1cc3c92ed6f77a60280191db3b74bc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Introduce namespace QtTimeZoneCldr instead of having a Q prefix on
each class name used for the data.
Change-Id: Icb22a91340b67f9cc93173b77374a70f69f81bbe
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
ICU returns a "valid" representation of GMT when given an unrecognised
ID, so QTZ's constructor has been checking the ID is available before
passing it to the backend constructor. That availability check was
done by generating the list of available IDs to see if the given ID
was in it; this is very inefficient. Furthermore, the QTZ constructor
was also checking availability, to work round the same issue in only
this one backend, making the check redundant.
So overide isTimeZoneIdAvailable() in the ICU backend, calling
ucal_getCanonicalTimeZoneID(), which answers the question directly;
and drop the duplicate check in the QTZ constructor. Expand a test to
verify an invalid name is rejected.
Fixes: QTBUG-121807
Pick-to: 6.7 6.6 6.5
Change-Id: I34f996b607b958d12607a94eb273bb1b406cca1a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Make QFreetypeFace::getFace() not return the same font
face for all memory fonts.
QtFreetypeData has a cache which maps QFontEngine::FaceId
to QFreetypeFace instances. Each FaceId should then
have a unique hash value, which is accomplished by
by hashing the font file name and a stored uuid.
However, we were not setting the uuid in all cases,
which means that in-memory fonts (which do not have
a file name) would hash identically.
Fix this by setting the uuid to a value based on the
address of the FontFile, which should be unique.
Pick-to: 6.7
Change-Id: I45de37b512fb666c26490551c831c0db824b5f35
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Unloading plugins after each test case in QtDeclarative autotests leads to crashes (signal 11) during type registration in subsequent test cases.
The issue arises due to the unloading process, where unloading and then re-registering types in the next test case leads to sig11.
Disabling the unloading of libraries prevents the crashes.
Pick-to: 6.7
Task-number: QTBUG-115777
Change-Id: I6712f687134fd452fb0b962363a8f0fde85344ff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This fixes a memory leak due to a missing call to release
on the localized names in populateFamilyAliases(). The
DirectWriteScope makes this automatic when it goes out
of scope.
We did release in the other places, but for hardening
the code a bit, this also adjusts them to use the scope
guard.
Change-Id: I88402fad930e36cdd3a78244941fb53ca214520e
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
To enable setting a default priority for all requests to a given site.
Fixes: QTBUG-121669
Change-Id: Icd8a9c59e4afb0432c65f84cc8115ae0c7f85506
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
onLoaded and the initial expose/paint should be sequenced
such that onLoaded is fired first, followed by the expose.
This makes sure that we don't spend any time on painting
frames before Qt is completely initialized.
Add a "requestUpdateHold" mode to QWasmCompositor (initially
on) which disables requestUpdate calls, as well
as releaseRequestUpdateHold() which enables requestUpdate
calls again. This is a one-way transition; the mode
can't be enabled again.
This amends commit f2e22774 which implemented the concept
of startup tasks, where onLoaded can be delayed until
for instance font loading has been completed. After
this commit the expose event and initial commit will
be delayed as well.
Change-Id: Icc784306726174fbabe8785d54485860e968745a
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
When cross-compiling, host rcc might generate zstd compressed
resources, even though the target might not support zstd
decompression.
To avoid that, we made sure to disable zstd compression when using
cmake api like qt_add_resources if the target platform does not
support it.
We did not do it for CMAKE_AUTORCC though.
In such a situation, the linker would fail with:
error: undefined symbol: qt_resourceFeatureZstd
Add the --no-zstd option to AUTORCC_OPTIONS for targets that are
created by Qt CMake public API like qt_add_executable and
qt_add_library if the target platform does not support zstd
decompression (check via the QT_FEATURE_zstd variable).
This in turn applies to our own qt_internal_add_ API as well.
Allow opting out via the QT_NO_AUTORCC_ZSTD CMake variable.
[ChangeLog][Build System] Targets created with qt_add_executable
and qt_add_library will now add the --no-zstd option to AUTORCC_OPTIONS
when the target platform does not support zstd decompression. You can
opt out via the QT_NO_AUTORCC_ZSTD cmake variable.
Pick-to: 6.5 6.6 6.7
Fixes: QTBUG-121948
Task-number: QTBUG-106466
Task-number: QTBUG-101353
Change-Id: Ibdcfecd9a4b1e206479a3f4588b1b624dd91e122
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Change-Id: I508edd50f4fa8a799dcfd746a0a916e3e39be84d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
We cannot remove the overload using QT_REMOVED_SINCE, because a qint64
lvalue in the new overload will not bind to an uint& parameter, so the
old code would not compile.
Deprecate the old overload, and add a unit-test that makes sure that
it still behaves correctly.
This commit also introduces the new deprecation macros that are
required to do the deprecation in Qt 6.11.
Amends fd48ce0b73
Found in 6.7 API review
Pick-to: 6.7
Change-Id: I02893bfbe040df736f8e746384e0261a0f0041d3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The operator was not converted to using a new streaming version, so it
supported only 32-bit length.
Fix it and add a manual test for serialization/deserialization of
large c-style strings.
Amends fd48ce0b73
Pick-to: 6.7
Change-Id: I83704edec021d400b992de810feba5da52d5ffe1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
If the underlying QDataStream's device already contains all data that
we want to read, we can optimize the allocation algorithm, and try to
allocate all needed memory at once.
Use bytesAvailable() to determine if the underlying device can provide
all requested data, and adjust the initial block size based on the
result. If not all data is available, fall back to the geometric
growth algorithm.
Change-Id: I6384d2caa16c238c2dbb77b2ad761cbd8a44df6c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The algorithm tries to allocate the memory using 1 Mb blocks.
When the input data is large, this results in a lot of reallocations,
which is slow and inefficient.
This patch modifies the algorithm in such way that the allocation size
increases at each step, resulting in geometric growth of the buffer.
Pick-to: 6.7 6.6 6.5
Change-Id: I071df68d51ba1dbd8b2eb5f94eb078a33223505f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Set this status when the stream tries to write more data than the
current serialization format supports.
Update the methods that write containers to return early if they fail
to write the container size, and do not try to serialize the elements.
Convert the manual tst_manualqdatastream test into a data-driven
test, allowing us to specify various stream versions. Adjust the test
code to check that the SizeLimitExceeded status is set when the
stream version is <= Qt_6_6.
Amends fd48ce0b73
Found in 6.7 API review
Pick-to: 6.7
Change-Id: If4c62ea53ac9bccd423f00f0f03afd6ba6bdc4f5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Do that to avoid narrowing at the call site on 32-bit platforms.
Amends fd48ce0b73
Found in 6.7 API review
Pick-to: 6.7
Change-Id: I31142399385521d973b2ed3789745569e44d5d63
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
By wrapping the use of the timeout value in QTRY_IMPL in a lambda that
feeds the user input through the std::chrono::milliseconds constructor
with std::chrono_literals in-scope, the macros continue to work with
raw integral values as well as chrono literals not finer than
millisecond granularity.
Port all higher-level macros to pass a chrono literal and port some
uses in tst_selftests.
[ChangeLog][QtTest] The QTRY_*_WITH_TIMEOUT macros now also accept
chrono literals (was: int milliseconds).
Fixes: QTBUG-121746
Change-Id: Ib38406fc005a0a2c4ae3fd009760f73ad8bed355
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
According to QUIP-18 [1], all tools file should be
LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
[1]: https://contribute.qt-project.org/quips/18
Pick-to: 6.7
Task-number: QTBUG-121787
Change-Id: I89e08859871d29a9cf8c7a56b30b07b2c2f34b42
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
According to QUIP-18 [1], all examples file should be
LicenseRef-Qt-Commercial OR BSD-3-Clause
[1]: https://contribute.qt-project.org/quips/18
Pick-to: 6.7
Task-number: QTBUG-121787
Change-Id: I185ebdff2faa5e4af6ac0ee77c3ae33faae06e7d
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
When using a style sheet, Q(Plain)TextEdit::isReadOnly() might get
called during the initialization before d->control is properly
initialized which lead to a crash.
This amends 43ce457cbd.
Fixes: QTBUG-121697
Fixes: QTBUG-121790
Task-number: QTBUG-1857
Pick-to: 6.7 6.6.2 6.6 6.5 6.2
Change-Id: I15c357c9eef7f6559bcc2ad89033a3d8e7fcbfef
Reviewed-by: David Faure <david.faure@kdab.com>
The perivous version generated weird condition, and seems changing
the QT_NAMESPACE after qtbase configuration is noop, we may replace
the generated condition with the conditional generation.
Change-Id: Ifa09dba4db00099a07da2cff5505e6fd0b008289
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Make QNetworkAccessManager to discard all informational (1xx) replies
from HTTP servers with the exception of 101.
According to RFC 9110:
"A client MUST be able to parse one or more 1xx responses received
prior to a final response, even if the client does not expect one.
A user agent MAY ignore unexpected 1xx responses."
Status code 101 is an exception because we use it to upgrade to http2
cleartext when it is enabled.
Fixes: QTBUG-108068
Change-Id: I415ff053180a43f0c7ff1b4b2a60fd114ce08ac9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
If extract_android_style meta data is set to none currently the app
still tries to extract full stlye and crashes. If this option is set
no style data should be extracted after this patch.
Pick-to: 6.7
Fixes: QTBUG-121667
Change-Id: I764e1eb6a582073196f991ca930d245d17a1f7e5
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>