Commit Graph

54430 Commits

Author SHA1 Message Date
Thiago Macieira
60db7a5dc1 Doc: QSysInfo::productType: remove the "will be" note about Qt 6
Fixes: QTBUG-99413
Pick-to: 6.2 6.3
Change-Id: Ib42b3adc93bf4d43bd55fffd16c360797871011b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-23 15:26:35 +00:00
Tor Arne Vestbø
cd2690dcbf iOS: Use generic simulator device for building apps via xcodebuild
If Xcode wasn't configured with any simulators the build would fail
since we had no device to build for. But we don't need to build for
a specific device, we can build for the generic simulator device,
just like we do for the non-simulator build. This likely didn't
work properly at the time it was first implemented, but now seems
to work fine, and is less fragile than the current solution.

Running tests still enumerates the available simulators,
as that needs a concrete device to run on.

Fixes: COIN-777
Pick-to: 6.2 6.3 5.15
Change-Id: I50e31c1b350cf83ce348275b467051263dea88a9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-12-23 15:26:35 +00:00
Thiago Macieira
1ed19dc018 QString: reorganize some template functions
This is going to screw up the git blame functionality (which is why they
were forward-declared instead of implemented on-site) but the
alternative is that Qt Creator thinks qstring.cpp had almost no
functions inside.

Pick-to: 6.3 6.2
Task-number: QTCREATORBUG-25594
Change-Id: Ib42b3adc93bf4d43bd55fffd16c1986f1a3c1574
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2021-12-23 11:41:32 -03:00
Tamas Martinec
d0908d0095 Document the State Machine Framework changes in the Core Migration Guide
Added section about having the State Machine Framework moved to its
own module.

Pick-to: 6.2
Pick-to: 6.3
Task-number: QTBUG-89285
Change-Id: I95d065230708d5b505d04309fd6ca21007d878dc
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
2021-12-23 16:14:54 +02:00
Morten Johan Sørvig
23964ce05f wasm: Use new event dispatcher for QtGui
The event dispatcher implementation is now in QtCore,
except for the call to QWindowSystemInterface::sendWindowSystemEvents().

Implement QWasmWindow::requestUpdate() using emscripten_request_animation_frame(),
instead of the previous registerRequestUpdateCallback() function
which now is removed.

Pick-to: 6.3
Change-Id: I7a13eb5391d48dba0f2afe4704ef3188b8daa74b
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-12-23 11:21:57 +01:00
Morten Johan Sørvig
e98f5de6e1 wasm: add virtual processWindowSystemEvents()
The QtCore event dispatcher will be used from QtGui
as well. Add virtual function where window system events
processing can be added.

Pick-to: 6.3
Change-Id: Ia6eda9ae18b2e91189ef9f60b6621d19a83313de
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-12-23 11:21:53 +01:00
Yuhang Zhao
054b814daa Add QObject::isQuickItemType() for convenience
Change-Id: Ibde4e919ba028117336974eb7a804aa11c1ee086
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-12-23 17:38:47 +08:00
Marc Mutz
50ad52d804 tst_qsharedmemory: skip readOnly() test under asan
The test helper is expected to crash, but when built with asan, it
just fails.

Skip the test in that case.

Pick-to: 6.3 6.2 5.15
Change-Id: I583142f5ec623895df62498100c1a30539b149ab
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-12-23 08:14:02 +01:00
Oliver Eftevaag
b369dc6021 QTextHtmlParser: fix prefix lookahead and html comments
The hasPrefix() function would only use the second 'lookahead' parameter
to check if there was more unparsed text after the current character.
When it's obvious from the codebase that it should actually look ahead
of the current character being processed, and compare againt that future
character.

Html comments were also not handled quite right. Partially because of
the broken hasPrefix() function, but also because it would advance the
current index tracker by 3 instead of 2. Remember that the beginning of
an html comment is <!-- meaning that there are only supposed to be 2
dashes required, not 3. The result would be that something like this
<!----> would not automatically close, because the current index tracker
would jump over the first 3 dashes when it begins a comment, and the
remaining unprocessed string would be ->

Also, because of the broken lookahead in hasPrefix(), a comment could
actually be started with just <!- not requiring a second dash at all.

Pick-to: 6.3 6.2 5.15
Fixes: QTBUG-99147
Change-Id: I8f4d4a1107eaf2dae16d16b7b860525d45a1c474
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-12-22 15:56:30 +01:00
Volker Hilsheimer
0462d24dcd Deliver context menu event with correct coordinates to widgets in popups
If a popup is open, Qt delivers events to the popup child under the
mouse, so we need to correctly translate the local position of the
context menu event to that child's coordate system.

This is already done correctly for regular mouse events, so use the same
logic here.

Fixes: QTBUG-99371
Pick-to: 6.2 6.3 5.15
Change-Id: Ief24c755e76d4d1aa2304b06662ed26ae309f684
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-22 14:09:56 +01:00
Marc Mutz
58058794b1 tst_qmetatype: fix memleaks
We didn't delete the new'ed up QMetaTypeInterfaces, causing asan to
complain.

Fix by storing them in strong references alongside their users in a
statically-allocated container.

We use shared_ptr to hold them, because QMetaTypeInterface doesn't
have a virtual destructor, so deleting objects of the TypeInfo types
(plural!) derived from QMetaTypeInterface though a pointer to the base
class is UB. The shared_ptr constructor, however, is templated, so it
stores the correct call (~TypeInfo()) in its type-erased deleter.

We can't use std::make_shared(), because that doesn't support
aggregate initialization until C++20, so we manually new up the
TypeInfos.

5.15 is not affected.

Pick-to: 6.3 6.2
Change-Id: Ic7ec88c34e02a9e0dd3421848c0c0885f4756702
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-12-22 13:41:30 +01:00
Marc Mutz
b6239f70f5 tst_QStringBuilder: remove test that doesn't test anything
We now have a more reliable test for the case with freeSpaceAtBegin(),
so remove the old test, after we verified it actually doesn't even
test that case.

Task-number: QTBUG-99330
Pick-to: 6.3 6.2
Change-Id: Ic108a722cd2fef1e63a05085a76d7572d1f8c875
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-12-22 13:01:25 +01:00
Janne Juntunen
bd40e43695 Exclude tst_QLocalSocket::verifySocketOptions() on webOS
This test case fails on qemux86_64-webos-linux environment and based
on comment on the test case, it probably cannot be expected to pass on
webOS.

Fixes: QTQAINFRA-4717
Change-Id: Ifb34b0c85da2d180a59529791d1109185fef2665
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-12-22 09:58:21 +02:00
Volker Hilsheimer
41f96866ee Windows: Don't crash in mouse handling when QApplication is recreated
We store the primary pointing device in a static variable to avoid the
lookup for each mouse event. However, when QApplication is destroyed,
then the device is destroyed, and the pointer needs to be reset so
that QApplication can be created again by the same process without the
first mouse event crashing the program.

Use QPointer to prevent the pointer from becoming dangling.

Fixes: QTBUG-99319
Pick-to: 6.2 6.3
Change-Id: Ie534c5eee48afb83e3a4adf70fc6cb4a2c310a7a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
2021-12-22 01:34:56 +01:00
Tor Arne Vestbø
7bd243b3fb macOS: Don't read keyCode of non-key events when inserting newlines
When the system input method decides to trigger an insertNewline
message it might come from a synthetic NSEvent of type AppKitDefined,
which does not respond to the keyCode message. Accessing the keyCode
would result in an exception being thrown.

We guard for this scenario by moving the keyCode access into the
key-press and -release specific parts of the KeyEvent constructor,
making the KeyEvent usable with generic NSEvents (even if that
means it will only pull out the timestamp and modifiers).

We also prefer to use the currently interpreted NSEvent, if one is
available, when preparing the synthetic newline event. This ensures
that we get a valid timestamp and modifiers, since the synthetic
AppKitDefined event that the system IM generates does not provide
valid values for these.

Fixes: QTBUG-99186
Pick-to: 6.2 6.3
Change-Id: I050ae2aa2d8ded1be3541f746e6c052f3546e27c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-12-22 01:34:56 +01:00
Volker Hilsheimer
5d04c27a27 Stabilize tst_QGraphicsProxyWidget::scrollUpdate
The test waits a bit hoping that all paint events are delivered after
showing the widget so that we can count the rectangles that are getting
updated when scrolling.

Waiting for 20ms is too short unless the system is completely idle.
Based on testing on a local VM, 150ms produces reliable results.

Pick-to: 6.2 6.3
Change-Id: I7729e94eae41476be67291a2f664cff784f96c7d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-22 01:34:56 +01:00
Marc Mutz
6d4102729f QRingBuffer: remove QByteArray::resize()-shrinks work-around
QByteArray::resize() is now documented to not shrink capacity(), so
remove the extra reserve(0) work-around.

Change-Id: I3d5d944b9f01f8f84b31599548773198903aad4c
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
2021-12-21 22:56:00 +01:00
Marc Mutz
3552cf48e8 tst_QStringBuilder: verify a comment is actually misleading
The construction of the byte array doesn't actually yield
freeSpaceAtBegin() (anymore?), so the comment above it is misleading
(and the test didn't manage to catch QTBUG-99330, either).

Before removing the misleading test, verify that this assumption is
actually correct across all platforms.

Task-number: QTBUG-99330
Pick-to: 6.3 6.2
Change-Id: I2f497321abc26c4148ced5ac12a5880b9ff5ba9f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-12-21 22:56:00 +01:00
Marc Mutz
c47c98ea2b QDateTime: fix UB (signed overflow) in addDays()
The comment indicated that the author expected any overflow to be
caught by a bounds check in the subsequent function, however, signed
overflow is UB, so anything can happen.

Fix by using our API for safe additions instead.

Pick-to: 6.3 6.2 5.15
Change-Id: I41909defffa5305b02fdfcf6d5808e0d9fd5924f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-21 20:36:46 +01:00
Marc Mutz
52da10f645 QVariantAnimation: fix UB (FP 0/0) in interpolated() arg calculation
When startProgress, endProgress, and progress were all 0 (as provoked
by tst_QPropertyAnimation::startWithoutStartValue()), we'd calculate
0/0 and ubsan complained:

  qvariantanimation.cpp:284:60: runtime error: division by zero

Fix by detecting progress - startProgress == 0 and setting
localProgress = 0.0 in that case. This is a logical result, even
though it might not be what IEEE754 rules would have yielded.

A more comprehensive change that aims to reliably keep localProgress
∈ [0,1] and thus avoid the infinities when endProgress ==
startProgress, is outside the scope of this patch, which deals only
with the UBSan error.

Pick-to: 6.3 6.2 5.15
Change-Id: I5258b054a2060006795f49fb1cd7604aea3ed46b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2021-12-21 20:36:34 +01:00
Igor Kushnir
b330016cf2 QMimeDatabasePrivate: deduplicate QStandardPaths uses
Change-Id: I81dc76ddcf2aaa8aa6fdca504384ed72ad27f344
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-21 21:21:50 +02:00
Igor Kushnir
0dbbda670d QMimeDatabasePrivate: deduplicate QStringLiteral
defaultMimeType() cannot be moved out of the class and defined in
qmimedatabase.cpp, because it is called from QMimeType::isDefault() in
qmimetype.cpp.

Return m_defaultMimeType constant by reference rather than by value from
the inline helper function. This eliminates useless copying of QString
when calling code needs only a reference, and so improves performance.
Even though m_defaultMimeType is initialized with a QStringLiteral and
its QArrayDataPointer has d == nullptr, QArrayDataPointer's ref() and
deref() still have to compare d with nullptr to decide that no reference
count manipulation is needed. Compilers might be unable to reorder these
checks with surrounding code because they guard reference count
manipulation. Branch misprediction could further harm performance.
Optimizing these checks out can be difficult for compilers.

Change-Id: I3ffa0fdc5ad948452301dd9688073b5323a7983b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-21 21:21:50 +02:00
Marc Mutz
11409f4c02 QStringBuilder: handle freeSpaceAtBegin() in op+=
Amends 9b320edb53.

The above commit made the mistake of relying on the 30yr+ old
fundamental relation

    size() - capacity() == freeSpaceAtEnd()

which, however, Qt 6's prepend()-optimization (freeSpaceAtBegin())
broke. Because of that, while size() - capacity() may be large enough
to hold the new data, if freeSpaceAtBegin() > 0, then freeSpaceAtEnd()
may not.

Fix by inspecting freeSpaceAtEnd() instead of capacity(). The
following reserve() call is unaffected, since it internally already
adds freeSpaceAtBegin() to the requested size, which is why the
unconditional reserve() in 9b320edb535a0fbe118933d2e983b73f90c32685^
worked while 9b320edb535a0fbe118933d2e983b73f90c32685's capacity()
check did not.

Fixes: QTBUG-99330
Pick-to: 6.2 6.3
Change-Id: I520f36216011423f97a24484263acd40d8b1fa43
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-12-21 18:14:17 +01:00
Igor Kushnir
1efae2dcad QMimeDatabasePrivate: construct QString from QStringLiteral
In the changed code no QLatin1String overloads exist, so replacing
QLatin1String with QStringLiteral improves performance by eliminating
allocations.

Change-Id: I77530fe72c309b0609f40b1dc34189bd3454c813
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2021-12-21 17:05:20 +02:00
Igor Kushnir
b45141a4c6 QMimeDatabasePrivate: pass QLatin1String to QStringBuilder
This should be more efficient than passing QStringLiteral.

Change-Id: Ia96633c9db6cb287dd9c196e739047b8a46abb4d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-21 17:05:20 +02:00
Igor Kushnir
6ad6df88dc QMimeDatabasePrivate: remove Release-only fallback
When mimeTypeForFile()'s `mode` argument equals none of MatchMode
enumerators, an assertion fails or the default MIME type's name is
returned if assertions are disabled. Simplify and optimize this code by
assuming MatchDefault in the unsupported-mode case.

Change-Id: Iada36e0c96c378aefaa3a9d4a170222f764e94b6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-21 17:05:19 +02:00
Morten Johan Sørvig
5a47e29914 wasm: prevent thread cross-talk when logging
Emscriptens implementation of fprintf does not provide
mutal exclusion when called from multiple threads, for
the emsdk versions Qt 5.15, Qt 6.2, and current dev
is using.

Pick-to: 5.15 6.2
Change-Id: Ied92730b735b11e4e5e85442de48fc25cbad0611
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-12-21 15:05:19 +00:00
Volker Hilsheimer
d99800dcac Make sure that QCocoaWindowManager is initialized in static builds
If code has no external references, then with a static build of Qt the
linker is free to strip those object files from the final executable.
This is what happened with QCocoaWindowManager, which had no exported
symbols, and no callers from other files.

To prevent the linker from stripping the object file and to ensure that
the constructor function gets called during startup, move that
function declaration to the QCocoaIntegration code, which is always
loaded.

Fixes: QTBUG-99280
Pick-to: 6.2 6.3
Change-Id: Icdafea372a1b42c6ecdb43e36aeb0a04a70e3d4e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-21 14:51:30 +01:00
Alexey Edelev
bde2764ab0 Check if QML plugin has the embedded QML files before copying to the Android bundle
We can detect if QML module has the embedded into the plugin QML files
using the 'prefer' record from qmldir files. No need to duplicate QML
files inside the android_rcc_bundle if 'prefer' record starts
with ':/'.

Pick-to: 6.3
Fixes: QTBUG-95984
Change-Id: Iee4f2248e3c0239c4f95a5db6e8fb3f16be636c5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-12-21 13:17:37 +01:00
Igor Kushnir
153ded9b95 QMimeDatabasePrivate: remove unused output parameter
mimeTypeForFileNameAndData()'s output parameter int *priorityPtr (named
differently "accuracyPtr" in the definition) is never used by its
callers. Remove it to shorten the code and slightly improve performance.

Change-Id: Ibc3d169501e89584b4318074ccb780580dc70fb6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-21 12:13:57 +02:00
Igor Kushnir
7a4da201b5 QMimeDatabasePrivate: remove duplicate file-opening code
Don't open the file in mimeTypeForFile(), because mimeTypeForData()
opens a closed device in the same ReadOnly mode. mimeTypeForData() also
returns mimeTypeForName(defaultMimeType()) when the opening fails.

Change-Id: If0b03e2bef3c1b1a2093157e005373adc4e289ed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-21 12:13:57 +02:00
Igor Kushnir
9eca0def34 QMimeDatabasePrivate: remove pessimizing const qualifier
mimeTypeForData() returns its local `QMimeType result` variable by
value. Make this variable mutable to allow moving from it.

Change-Id: Ic76e8382a5cacecc02e834a55f1ea86593c60674
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-21 12:13:57 +02:00
Igor Kushnir
49b726fa71 QMimeDatabasePrivate: remove duplicate else-if branch
In mimeTypeForFileExtension(), the `else if (matchCount == 1)` branch
differs from the `else` branch only in a comment. Remove the branch with
duplicate code, adjust the comment and simplify the `if` condition.

Change-Id: Ib97a057880373ab3ab9b585e688b38fe1f542ba2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-21 12:13:57 +02:00
Janne Juntunen
02f14d7afe qtestblacklist: add webOS support
Added support for blacklisting autotests for webOS platform
since it looks like we might have to blacklist some of those.

Task-number: QTQAINFRA-4706
Change-Id: I212be15161bd042f1511000ced2c8c022c3206e1
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2021-12-21 12:13:57 +02:00
Volker Krause
7f54e113b9 Make QAbstractItemModel::insert|move|remove(Columns|Rows)[s]() invokable
Useful for example for calling those from QML.

Change-Id: I07fe32944c76b58cb074b6dd7eff17af1f0ae00f
Reviewed-by: David Faure <david.faure@kdab.com>
2021-12-21 08:04:17 +01:00
Zhang Hao
8678ab9354 Use qint64 to replace int while qt_transform_image_rasterize
When rotating a very large image(for example,the image size is
42000*24000),using QTransform will cause the the variable of the
qt_transform_image_rasterize function exceeds the range of int.
Fix this by Use qint64 to replace int.

Fixes: QTBUG-99163
Done-with: Eirik Aavitsland <eirik.aavitsland@qt.io>
Pick-to: 6.3 6.2 5.15
Change-Id: I11e2873fbb1f432953a1a8e07054f9478dd90fbd
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-12-21 09:24:56 +08:00
Igor Kushnir
047d8f36de QMimeDatabase::mimeTypeForFile: don't create QFileInfo on UNIX
When mode != MatchExtension is passed to
QMimeDatabase::mimeTypeForFile(const QString &fileName, MatchMode mode) const
a QFileInfo object is always created and used to check
QFileInfo::isDir(). Replace this expensive approach with a very cheap
(bitmask) S_ISDIR check under Q_OS_UNIX. QT_STAT is already called for
other reasons, so we just reuse its result in the S_ISDIR check.

Extract almost all code from
QMimeDatabase::mimeTypeForFile(const QString &, MatchMode) const;
QMimeDatabase::mimeTypeForData(QIODevice *) const;
QMimeDatabase::mimeTypeForFile(const QFileInfo &, MatchMode) const
into
QMimeDatabasePrivate::mimeTypeForFileExtension(const QString &);
QMimeDatabasePrivate::mimeTypeForData(QIODevice *);
QMimeDatabasePrivate::mimeTypeForFile(const QString &, const QFileInfo *, QMimeDatabase::MatchMode)
respectively. This refactoring is a less convoluted and more efficient
alternative to adding more mutex-unlocking hacks. The existing
QMutexLocker::unlock() calls are thereby eliminated.

The following table contains the average results of the benchmark
tst_QMimeDatabase::benchMimeTypeForFile() on my GNU/Linux system before
and at this commit. The numbers denote milliseconds per iteration.
This commit does not measurably affect performance when
mode == MatchExtension, therefore the MatchExtension section contains a
single column with results common to both commits (it is interesting to
compare benchmark results across match modes).

        data row tag                        before  at
MatchDefault:
        archive                             0.012   0.010
        OpenDocument Text                   0.012   0.010
        existent archive with extension     0.022   0.018
        existent C with extension           0.016   0.012
        existent text file with extension   0.017   0.012
        existent C w/o extension            0.072   0.067
        existent patch w/o extension        0.10    0.10
        existent archive w/o extension      0.064   0.060
MatchExtension:
        archive                                 0.0081
        OpenDocument Text                       0.0076
        existent archive with extension         0.012
        existent C with extension               0.0075
        existent text file with extension       0.0076
        existent C w/o extension                0.0122
        existent patch w/o extension            0.0091
        existent archive w/o extension          0.0091
MatchContent:
        archive                             0.0098  0.0078
        OpenDocument Text                   0.0098  0.0078
        existent archive with extension     0.051   0.047
        existent C with extension           0.051   0.047
        existent text file with extension   0.053   0.049
        existent C w/o extension            0.058   0.054
        existent patch w/o extension        0.099   0.095
        existent archive w/o extension      0.054   0.050

Change-Id: I01b37c9645f0d8d35fd1a6ea1c7a99be2faeeb73
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2021-12-20 20:43:27 +02:00
Alexey Edelev
fe7fc3f23e Copy only files that belongs to QML module
Instead of copying all files that the QML module directory contains,
this approach only copies files that belong to the QML module
according to the qmlimportscanner output.

Pick-to: 6.3
Fixes: QTBUG-97834
Change-Id: I881a6fba28ca24be4f33de8693b41b6dfefe8d6b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-12-20 18:08:10 +01:00
Marc Mutz
620220413e CMake: don't treat Q_CORE_EXPORT special
Let CMake create a qtcoreexports.h just like for every other Qt
library, include it in a fitting place in qglobal.h. Currently, that's
in the middle of the file, but that will be cleaned up in subsequent
commits.

Task-number: QTBUG-99313
Change-Id: I3ea9f4772b0ad63c7e8431689146cac3336c5ccf
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2021-12-20 13:32:28 +01:00
Tianlu Shao
87b93c29be QtConcurrent::run crashes on program exit
When an application is about to be closed and all the
destructors are called, if there isQtConcurrent::run on
the way, it crashes as the internal threadpool pointer
is nullptr.

Fixes: QTBUG-98901
Pick-to: 6.2 6.3
Change-Id: Idd84d1518fc6a225263e6666a0f1de2ccef79c82
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-12-20 13:18:26 +01:00
Tatiana Borisova
43e9f86cc1 tst_qglobalstatic is halted on INTEGRITY device
- Stress test creates too many threads on run time.
  Testing system is limited in 123.

Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: I215074fa432c8aa18b2a753169646841c01d0b2a
Reviewed-by: Kimmo Ollila <kimmo.ollila@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-20 10:14:38 +02:00
Ivan Solovev
f8b74a4957 QXmlStreamReader: update test distribution
As mentioned in the linked bugreport, we are not allowed to distribute
the uncompressed files from one of the XML test datasets that we use
in our tests.
This patch removes the uncompressed version, and replaces it by the
xmltest.zip archive taken from [0].
Once the test is started, QZipReader is used to uncompress the archive,
and once the test is done, the uncompressed data is removed.

However the test data from [0] is very old, so it is slightly different
from what we had previously (the previous data was taken from w3c).
As a result, 4 test cases are failing with this data. To fix it, we
store the updated versions of 4 xml files separately, and replace them
after uncompressing the archive.

[0]: http://www.jclark.com/xml/

Fixes: QTBUG-81503
Pick-to: 6.3 6.2 5.15
Change-Id: Ied5233970a529deebca56b1eab07fe1c328a2ee0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-12-19 18:58:44 +01:00
Ivan Solovev
5cc7510801 QZipReader: update to unzip partly broken archives
The problem was discovered while providing a fix for the linked issue.
The original zip archive is very old, and it does not contain separate
entries for directories, only for files.
As a result, QZipReader algorithm was failing to create all the
necessary subdirectory structures, and unzipping failed.

This patch detects such case, and creates a directory hierarchy based
on the file paths.

Task-number: QTBUG-81503
Pick-to: 6.3 6.2 5.15
Change-Id: I204f9b620853b3ffcbb9cbf6fe08fb5958776ea0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-12-19 18:58:40 +01:00
Kai Köhne
c52fcb2ad9 bindablesubscription: Remove duplicated file entry
Pick-to: 6.2 6.3
Change-Id: I7f24425c8ccfb11bda926373099d377f808a70dd
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2021-12-19 14:38:27 +01:00
Thiago Macieira
8db16bfa7e QString: use char16_t in isAscii() instead of QChar
Drive-by simple clarification of the code that needed to be touched
anyway.

Pick-to: 6.3 6.2
Change-Id: Ib42b3adc93bf4d43bd55fffd16c14f984b0fb592
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2021-12-18 18:09:21 -03:00
Thiago Macieira
1a9e7a3aad QString: don't let the compiler emit unnecessary looping
When AVX2 was enabled, we know we don't need to loop in qt_is_ascii()
(QtPrivate::isAscii(QLatin1String)).

Pick-to: 6.3 6.2
Change-Id: Ib42b3adc93bf4d43bd55fffd16c14f8f95ae8678
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2021-12-18 18:09:19 -03:00
Thiago Macieira
449f6d5f61 QString: replace an #if with if
Pick-to: 6.3 6.2
Change-Id: Ib42b3adc93bf4d43bd55fffd16c111291d1e8ddd
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2021-12-18 18:09:17 -03:00
Marc Mutz
dc672cf35a tst_QPropertyAnimation: fix leaks occurring under normal operation
Tests were leaking objects even if all tests passed. In two cases,
there just wasn't a delete at all, in a third, the existing delete
wasn't reached because of a QSKIP.

tst_QPropertyAnimation is now, locally, LSan-clean.

Pick-to: 6.3 6.2 5.15
Change-Id: Ia53d6f6e467f1d2598a7c50efcdf3a3732fe54df
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-12-18 10:38:21 +01:00
Yuhang Zhao
bdaab71c68 CMake: Remove WinRT leftovers from build system
Qt's WinRT support was removed long time ago.

Change-Id: I60b220e970072c3450e3793862d6f68801d2b5b3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-12-18 08:01:39 +08:00
Marc Mutz
9b320edb53 QStringBuilder: fix quadratic behavior in op+=
QByteArray and QString honor a reserve(n) faithfully, meaning that if
n > capacity(), then capacity() == n after the reserve() call.

This is expected behavior, and also what libstdc++'s std::vector does.

The problem is QStringBuilder's op+=, which calls reserve()
unconditionally to ensure capacity for its resize-after-append
magic. If a user builds up a string by repeatedly appending
string-builder expressions, these repeated minimal-progress reserve
calls destroy the string's natural geometric capacity growth, turning
it linear instead, and hence the whole construction becomes quadratic.

Fix by calling reserve() only when necessary, and for a maximum of
O(logN) times, N being the separate calls to QStringBuilder's op+=.

This guarantees amortized-linear runtime of string building again.

Need to insert an explicit detach() call in reserve()'s stead, lest a
detach() in the following data() would reset capacity() to size().

Copied a useful comment from the QByteArray case to the QString case.

[ChangeLog][QtCore][QStringBuilder] Fixed quadratic behavior when
repeatedly appending string-builder expressions (using operator+=) to
QString/QByteArray objects.

Pick-to: 6.3 6.2
Change-Id: I1c210a8d0026c227e55e5e30a46fb747660bb66e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
2021-12-17 23:50:01 +01:00