The QUuid(quint128) ctor was handing the incoming data differently
from the QUuid(Id128Bytes) ctor. Same was valid for the return
values of QUuid::toUint128() vs QUuid::toBytes().
The provided test didn't reveal it, because it was treating the same
128-bit input value as BE in one place, and as LE in another place.
This patch fixes the test, and updates the implementation of
QUuid(quint128) ctor and toUInt128() method to verify that the
updated test passes.
This commit amends 8566c2db85
Pick-to: 6.6
Change-Id: I24edb8ba0c8f7fd15062ba0b2a94ad387c3e98b6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
constexpr functions are implicitly inline
Found during API review.
Pick-to: 6.6
Change-Id: I94daa0a67336fa99a1465115edb83e545580a78a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
We don't key it on IP address anymore so we can drop
the use of QMultiHash.
This also requires moving the connections for error and disconnected
to readyForUse so we don't remove an active connection when a second
connection attempt happens from the same peer process.
But since we still need to deallocate those connection attempts
if they error out or simply disconnect, we connect their signals to the
QObject::deleteLater slot. In some cases we might call deleteLater twice
but that's fine.
Change-Id: I48c27de1e51a52ef61cfb941a7a81b358ae9ce3f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
The system was just treating IP (and optionally port) as a unique
identifier, so if a peer had multiple possible paths to a client they
would connect multiple times.
This fixes that by generating using QUuid in each client.
We then use this during broadcast, replacing the username we
sent before (which was not used), and as part of the greeting.
The greeting now is more complex, since we need to send both
username and the ID.
Change-Id: I6c6c2ffd5198406aad48445a68dd6aab36de69c0
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The treeWidget member of MainWindow could be initialized before the
body of the constructor, enabling it to be a *const variable.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: If4a3b04729bc7fa5859ca88183eec376f6992455
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Commit 8ea27bb1c6 adapted the definition
of Q_ASSERT already.
Adopt the same logic for QTEST_ASSERT.
Pick-to: 6.5 6.6
Change-Id: I5a5d0f62df79b18635d3b426a439c35b25d739c2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Windows with Qt::SubWindow flag should not have platform decoration.
Fixes: QTBUG-115054
Pick-to: 6.5 6.6
Change-Id: I7111df6057a087080194c1d46e350df839bec437
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
This is a follow up to a4ca9e8065,
adapting the backing store setters to become proper overrides of
the newly implemented QPlatformWindow::setBackingStore();
Pick-to: 6.6
Change-Id: Id4f5ff8650ca4e4d3cab1d71d27041c6129bf4ea
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
When converting from an array to a map, we double the number of
elements, spread the old elements out to make one free slot of space
in front of each, and then place Integer values counting from 0 into
the free slots.
The old code contained a loop that would add a strong reference to the
original elements that happen to be containers and thus are
ref-counted in the first place. But this additional strong reference
is not needed: In both cases, detached or in-place, the detach() call
that ensured unique ownership of 'map/dst' will have either directly
or indirectly updated the ref-counts of the elements correctly, and
the following loops just reshuffle the elements in the QList, they
don't create new copies (QtCbor::Elements doesn't by itself manipulate
container->ref, but even if it did, the copy would have increased, and
the assignment of the Integers would have decreased, the ref-count
again). Adding the strong ref without a user then caused the container
members to be leaked.
Fix by removing the loop.
[ChangeLog][QtCore][QCborValue] Fixed a memory leak when an array was
coerced into a map.
Amends ccea344640.
Not picking to 6.4 as it's closed at this time.
Fixes: QTBUG-115249
Pick-to: 6.6 6.5
Change-Id: I369c372e91c3f0cfe3c65f9b0ea8507d08fdaf48
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
earlyConstructedSockets is a QObject, but had no parent and was never
deleted, leaking all the data is holds.
Fix by giving it a parent.
The code predates the begin of the public history.
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: Ibc5688afd6111e84f591c37e39b6bb618d76c47a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The gc_sections linker flag was recently wrapped in a
$<CXX_COMPILER_ID> genex to prevent adding it the command line when
using an incompatible compiler.
This causes an issue when generating .pc pkg-config files because
$<CXX_COMPILER_ID> can't be used in the output of a file(GENERATE)
call.
Record the flag in a global property, both the genex-wrapped and bare
forms, so that we can perform a string replacement when generating
the pkg-config file to remove the genex wrapping.
This is not perfect, in the sense that consumers of the .pc file
might get the wrong flag if using an incompatible compiler, but
it's better than outright failing the Qt build.
Distros will be expected to patch the .pc files if necessary.
Note the issue does not usually happen for regular Qt builds because
gc_sections is only enabled automatically for static builds, but for
static builds we don't currently generate .pc files.
So the issue only happens in shared Qt builds where the gc_sections
feature is enabled manually.
Amends a2b6c2f343
Pick-to: 6.5 6.6
Fixes: QTBUG-115243
Change-Id: I3f6bdf86c24ee90b6da04994e458b438cc41fc7a
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
QWidget re-uses an existing backing store. Platform windows depend on
being associated to a backing store, in case they become toplevel
windows. If a platform window gets deleted and re-created each time it
is shown or hidden, it has to be manually associated to the re-used
backing store.
This patch partly reverts fbf0aeea7d3b38ced7a16fcd5c3e2e9b45536292.
It removes Android specific code from QWidgetPrivate::create(), which
has been added to suppress re-using backing stores in the absence of
the new API.
Fixes: QTBUG-97482
Pick-to: 6.6
Change-Id: Iaa1b7652efa120ec1955914c0383e8ccd8a41429
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
QWidget re-uses backing stores created in QWidgetPrivate::create().
The Android platform plugin creates a new platform window, when a
widget becomes a toplevel window. When it is hidden, the platform
window is deleted. The link between QAndroidPlatformWindow and its
backing store is made in the constructor of
QAndroidPlatformBackingstore. When a new QAndroidPlatformWindow is
constructed and the backing store is re-used, there is no more link
between platform window and platform backing store.
This has lead to screen assets not being painted, when shown more than
once.
This patch forces QWidgetPrivate::create() to construct a new backing
store on Android. This way, toplevel windows always have a backing
store associated with it. It adds an assertion to
QAndroidPlatformScreen::addWindow(). That will make e.g.
tst_QWidget::visible() crash without the fix.
Fixes: QTBUG-97482
Pick-to: 6.6 6.5 6.2
Change-Id: Ib1b172068b03549df161ab93ac24a273221d5423
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Qt 6 requires /utf-8 for user-projects by default, but allows users to
opt-out (cf. 0cdcbb40a1), so we shouldn't
use non-ASCII characters in public headers.
Amends 97f643faee.
Fixes: QTBUG-115229
Pick-to: 6.6 6.5
Change-Id: Ieb93ea9f3526e7bcc2e5aeffb5e69c68d10db792
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
It's Thomas Porter and Tom Duff, not Xavier and Yoann.
Pick-to: 6.6 6.5
Change-Id: I2e9345c06c299e9c0475831e21c3b9b85c58a32f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
QTest::toString() returns a new[]'ed char array, which needs to be
manually deleted and QVERIFY2() doesn't take ownership of its second
argument.
Fix by wrapping in unique_ptr<char[]>(...).get().
Bug exists since the dawn of the public history.
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I19ec09f46ec0ce5eacf1437f62dc625bc9343831
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Setting the parent of a QObject to nullptr means the ex-parent no
longer owns and deletes the object as its child, leaking it.
Fix by creating a scope-guard to defer deletion until the tests have
run.
This is simpler than the alternatives:
Putting it into unique_ptr would require a new variable name, or a
larger refactoring of the function, because the `test` variable is
being re-used for many different objects in the course of the
function, most of which should not be deleted.
Using QAutoPointer would drag in QtWidgetsPrivate, and the class is
probably not available in all active branches.
Finally, deleteLater() would require reliably returning to the event
loop, which may not happen if the test is run in isolation.
Bug exists since the dawn of the public history, and QScopeGuard is
available in all active branches.
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: Ib4fcb44b0b68d4ccbcf5af144a18ffb378a72213
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
They have no preconditions and cannot throw.
Pick-to: 6.6
Change-Id: I9c3020e00cffc84dfc3a14469cbb80557a4df5cf
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Support UIA property IDs UIA_DescribedByPropertyId,
UIA_FlowsFromPropertyId and UIA_FlowsToPropertyId
by using the Qt relation types newly introduced in
f5358e5932.
As described in f5358e5932
and afbfe30093 for AT-SPI,
the relation type needs to be "inverted" for UIA just the
same, since Qt's semantics is the other way around.
Task-number: QTBUG-105864
Change-Id: Id557389af6609197f4c3b37741e4201028627004
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
tst_QThread peeks into QThreadPrivate, which means that a UBSan build
needs access to QThreadPrivate's type_info, for which we need to
export the class.
Amends 268ff00ef5.
Pick-to: 6.6 6.5
Change-Id: Ic26df3d323d50b51d369d5f2bd78db7e047b5341
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's not needed anymore, because the class is no longer part of the ABI.
Pick-to: 6.6
Change-Id: Idfacc6023288ce603b30ab5aa904106e8c850444
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
In C++20 std::basic_string_view has gained a range constructor (like
QStringView always had), but that range constructor has been made
explicit. This means we can't just pass a QString(View) to a function
taking a u16string_view. The consensus seems to be that that types that
should implictly convert towards stdlib's string views should do that
via implicit conversion operators. This patch adds them for
* QByteArrayView => std::string_view
* QString(View) => std::u16string_view
* QUtf8StringView => std::string_view or std::u8string_view, depending
on the storage_type
QLatin1StringView doesn't have a matching std:: view so I'm not enabling
its conversion.
QByteArray poses a challenge, in that it already defines a conversion
towards const char *. (One can disable that conversion with a macro.)
That conversion makes it impossible to support:
QByteArray ba;
std::string_view sv1(ba); // 1
std::string_view sv2 = ba; // 2
because:
* if only operator const char *() is defined, then (2) doesn't work
(situation right now);
* if both conversions to const char * and string_view are defined, then
(1) is ambiguous on certain compilers (MSVC, QCC). Interestingly
enough, not on GCC/Clang, but only in C++17 and later modes.
I can't kill the conversion towards const char * (API break, and we use
it *everywhere* in Qt), hence, QByteArray does not get the implicit
conversion, at least not in this patch.
[ChangeLog][QtCore][QByteArrayView] Added an implicit conversion
operator towards std::string_view.
[ChangeLog][QtCore][QString] Added an implicit conversion operator
towards std::u16string_view.
[ChangeLog][QtCore][QStringView] Added an implicit conversion operator
towards std::u16string_view.
[ChangeLog][QtCore][QUtf8StringView] Added an implicit conversion
operator towards std::string_view (QUtf8StringView is using char
as its storage type in Qt 6). Note that QUtf8StringView is planned to
use char8_t in Qt 7, therefore it is expected that the conversion will
change towards std::u8string_view in Qt 7.
Change-Id: I6d3b64d211a386241ae157765cd1b03f531f909a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Modify configure.cmake to avoid breaking static builds
while using RenderDoc with QGraphicsFrameCapture.
Change-Id: Id0f39304b20ab3a98bfb0206cf5b52031d38f0ab
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
... and out of QtPrivate.
No inline API requires it anymore, so move it into the only TU using
it. Can't move it into the unnamed namespace because of the friend
declaration in QFutureInterfaceBase.
Pick-to: 6.6
Change-Id: I27452960492bc1193a4d0eaeb2acd913d4dd02a5
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
...when using a Qt cross-built for embedded Linux and
NO_UNSUPPORTED_PLATFORM_ERROR set.
Attempting to install such a project will now give the following output:
-- Skipping runtime deployment steps. Support for installing runtime
dependencies is not implemented for this target platform (Linux, shared
Qt libs, cross-compiled).
Pick-to: 6.5 6.6
Fixes: QTBUG-114069
Change-Id: Idd2af2135d2ca3cc0e5eeafb7701e891f8a0cc25
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The old code violated the following principles:
- DRY: the same code occurred 3× in the code-base
- SCARY: the vast majority doesn't actually depend on template
arguments, causing template bloat
Solve both with a tiered Extract Method.
We cannot change the order of the operations performed on
QBasicFutureWatcher, in particular not the connect() to the
contination w.r.t. setFuture(), so we cannot leave the connect to the
continuation lambda outside the function, as it would mean to also
leave the setFuture() call outside.
Thanks to Volker's makeCallableObject(), we can, however, type-erase
the lambda using QSlotObjectBase, which is what connect() internally
creates, anyway, therefore bringing the whole function behind the ABI
boundary.
As a non-QObject, non-QMetaObject friend, we're lacking support for
actually doing something useful with a QSlotObjectBase, but that can
be fixed in the implementation now. The interface is stable, which is
what matters for 6.6 now.
This will allow a subsequent commit to drag QBasicFutureWatcher behind
the ABI boundary, unexporting it.
Saves a whopping 8KiB in tst_qfuture text size on optimized C++20
Linux AMD64 GCC9 builds.
Pick-to: 6.6
Done-with: Fabian Kosmale <fabian.kosmale@qt.io>
Change-Id: I0e5c2564907d92f6938689ab249be11fc0332ba5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Extract Method non-template customConstructSharedImpl() to avoid
instantiating std::unique_ptr with a different per-F Deleter over and
over again.
Not picking to 6.5 because the function was confined to the
qvariant.cpp TU in those versions.
Cf. 11791e2a50 and
d783363f60 for similar issues.
¹ https://www.open-std.org/jtc1/sc22/WG21/docs/papers/2009/n2911.pdf
Pick-to: 6.6
Change-Id: I73d21d929a7db2ab47f62a3246cf913d82e3db75
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Amends 5f531ae2ac
The overload taking QDeadlineTimer::ForeverConstant was required,
prior to making it an enum class, because the conversion preferred
'int'. It was made an enum class for 6.6 and most overloads were
removed, including the one for QMutex, but QRecursiveMutex was
missed.
Pick-to: 6.6
Change-Id: I4490dd3d7641c06346ea502f10c09915411319ad
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This reverts commit c3c5d2cab0.
Reason for the revert - it breaks the purpose of the Qt::Uninitialized
ctor
The commit also updates the QUuid(quint128, QSysInfo::Endian) ctor
to avoid the compiler errors:
error: member ‘QUuid::data*’ must be initialized by mem-initializer
in ‘constexpr’ constructor
Pick-to: 6.6
Change-Id: I0057fab3d7203adaddad3e890129668923a9eef6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
syncqt uses qt_deprecates pragma to generate deprecated header files
that might live forever in Qt packages. This adds the version argument
to the pragma, that allows specifying the version when the respective
header file should be removed. The new pragma format is the following:
pragma qt_deprecates(<header>[,<major.minor>])
If deprecation version of the deprecated header file is lower than
the current Qt version, syncqt will display the respective warning in
the log and skip generating the deprectated header file.
Also the user warning message now displays the exact version when the
header file will be removed.
Task-number: QTBUG-115029
Pick-to: 6.6
Change-Id: Ifd7464b8539b8be93b95690fd1ca70ef0b14e436
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Standalone test projects have the following condition in the
beginning of their project:
if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
find_package(Qt6BuildInternals COMPONENT STANDALONE_TEST)
endif()
When configuring the project the first time, QT_BUILDING_QT is not
set, find_package is called, configuration succeeds.
But because standalone projects implicitly include QtSetup.cmake,
that file sets the QT_BUILDING_QT cache var to true, and upon test
reconfiguration, cmake errors out with:
Unknown CMake command "qt_internal_add_test"
or similar.
This happens because QT_BUILDING_QT is true on the second
reconfiguration and the find_package mentioned above is not executed
anymore, leading to unknown internal command errors.
Set a new QT_INTERNAL_IS_STANDALONE_TEST variable when we detect
a standalone test and check for its value in QtSetup so we don't
set QT_BUILDING_QT to TRUE anymore.
Adjust a few code locations where QT_BUILDING_QT being false might
trigger different behavior for standalone tests.
Task-number: QTBUG-93020
Change-Id: I5413b9f37653225175a1006f7626e023045b5979
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Also prepend a "Error:" label to all strrerror handling locations,
to make it clear where the error starts.
Pick-to: 6.2 6.5 6.6
Task-number: QTBUG-101926
Change-Id: I1a781b4c5716636eff4d47a6c8554dcbd51d2697
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The documentation claimed the exact opposite of what the
implementation did. Since callers use it the way it's implemented, fix
the doc.
Fixes: QTBUG-112895
Pick-to: 6.6 6.5
Change-Id: I74d6259727c7af7265224c6d79ba39265663704b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
E.g. the view.layer thread checker problems are eliminated
for some time now. The other mentioned XCode warning is
likely not there anymore with newer XCode. Whereas the
rest (that we pass validation) should be obvious.
Pick-to: 6.6 6.5
Change-Id: I9754077aa6e178ee2b866b64538991412af5bb5a
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Amend 813bbc515b. Unclear why this
passed CI, but we can't use implicit conversion of string or character
literals.
Pick-to: 6.6
Change-Id: I1b3515e42b09a5caae1e632320b8251c27177f52
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Bring back & update comment on -Za, which was removed
in 8bf60251 (in turn reverted in commit 2dcc3059).
For the details on -Za vs -permissive, see
https://devblogs.microsoft.com/cppblog/permissive-switch/:
and the official Microsoft documentation.
This amends 2dcc30592b.
Change-Id: Ibeb135218dd0a17eddf821ad79246906993c586f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
I cannot get it to fail on my local machine
Change-Id: Iec30858df6bf5ef51a805745745cc0e98e8db03a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>