The QSemaphore acquire & release functions, plus the constructor and
destructor, can be made noexcept on platforms that use futexes
(currently, Linux and Windows; likely macOS by the time we make 7.0). I
didn't make the change right now because the acquire and release
functions have narrow contracts on the int n values. I didn't make that
change now because it make a mess of the code, for little gain as this
class isn't used that often.
Plus, we may want to investigate whether we want to keep the multi-token
semaphore functionality around (something neither POSIX sem_t nor
std::counting_semaphore have), or split that off into a separate class
like QBasicMutex / QMutex / QRecursiveMutex was done.
Change-Id: Ieab617d69f3b4b54ab30fffd175b27813728f2ce
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
In function ‘int qt_safe_connect(int, const sockaddr*, socklen_t)’,
inlined from ‘bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress&, quint16)
qnet_unix_p.h:111:38: error: ‘sockAddrSize’ may be used uninitialized [-Werror=maybe-uninitialized]
qnativesocketengine_unix.cpp:396:18: note: ‘sockAddrSize’ was declared here
qnativesocketengine_unix.cpp:476:14: error: ‘aa.qt_sockaddr::a.sockaddr::sa_family’ may be used uninitialized [-Werror=maybe-uninitialized]
qnativesocketengine_unix.cpp:471:17: note: ‘aa’ declared here
Introduced by commit 45a03fc506.
Change-Id: I5f7f427ded124479baa6fffd175fbf006c098854
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
If a platform builds up a list of QPlatformScreens, and then adds
them incrementally, while at the same time implementing virtualSiblings
in QPlatformScreen to return the full list of screens, the virtual
sibling QScreens will contain nullptrs for each non-added screen.
It could be argued that this is the fault of the platform plugin,
since it's reporting a virtual sibling that it hasn't added yet,
but we can easily work around it in QScreen as well.
Fixes: QTBUG-113977
Pick-to: 6.5
Change-Id: I4b9472646a5cc10b6fd35c606e3ae15941da1587
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
In cases where we allow symlink, we need to use ABSOLUTE path, and don't
resolve the symlink. This function returns ABSOLUTE only if we are on
Apple platform, and have QT_ALLOW_SYMLINK_IN_PATHS enabled. While this
is mainly to resolve the issue report by Homebrew, it might be useful if
a user really want to build with symlink.
Pick-to: 6.5
Task-number: QTBUG-113463
Change-Id: Ided141ed8de66cc1d3717ec2719eb703fa7fc589
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Add an empty line between the two.
Pick-to: 6.5
Change-Id: If1c50ebb0b825acc53364cce2e083332367e757c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Will be re-used in the upcoming emplace() function.
No attempt is made to re-write the expression to be more
readable. That's left for another commit.
Task-number: QTBUG-112187
Change-Id: Id391b78f1477c5225beda8a32c4f6c1393dd51bb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
By not explicitly disabling min/max macros of `windows.h`, we may see
some unintended substitutions. This is especially important now that we
are moving toward enabling Unity Build, and some of the constructs for
manually dealing with this issue, eg., `#ifdef max`, `#undef max`, might
not make it to the pool, and as a result we get build failure.
Pick-to: 6.5
Change-Id: Ie3c31aebe00300126a2ac3a6044876ab92d5d99c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Will be re-used in the upcoming emplace() function.
Task-number: QTBUG-112187
Change-Id: Ie2b4570b7ba6c9d0ce938203933758a0d0d59f5a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Due to short-cut evaluation of the built-in op||, we can do the
following transformation:
- (X && Y) || !X
+ !X || Y
Pick-to: 6.5
Change-Id: Ia5ae1dd60bdb663aa4648c09372be1598591110d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
QVariant::clear() hasn't been virtual since at least Qt 4...
Pick-to: 6.5 6.2 5.15
Change-Id: If6b5669d91f8d9c7ed2d152d18852a8d6f8e491a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
When a custom projection is used in the assign() function, there is a
problem with the optimization step at:
dst = std::uninitialized_copy(first, last, dst);
The issue arises because this copy doesn't respect the custom
projection. To address this problem, we need to ensure that the
optimization is only applied when using the identity projection.
Amends: 7ca633d9a8.
Change-Id: I912525c716333ee2c22c419f2bf70201086c5635
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
They were made redundant at Qt 6, so now they're just defined and undefined.
Don't even do that any more.
Change-Id: Ic4a4a4c39c50c9af417ea6c52be5f69a2d4856c6
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If module doesn't contain headers we should skip adding install
rule of the geneated by syncqt module headers, since the staging
directory will not be created in this case.
Change-Id: I89db5f1447d60cae48cd6ae4b9ef080dcf50e34c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
CMake not necessarly sets MSVC or MINGW when detecting Clang compiler.
We should rely on CMAKE_CXX_COMPILER_FRONTEND_VARIANT instead when
detecting Clang platform.
Fixes: QTBUG-113630
Pick-to: 6.5 6.2
Change-Id: I8c14939ddc0839ddf2b3419392aa843deeef4bb5
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The if statements were originally broken to fit 80-column width
but didn't have the braces we typically require.
It anyway fits inside our new 100-column width, so just do that.
Task-number: QTBUG-108873
Change-Id: Ib632f35607e6b716141c4c5d8211de7a0745c6ab
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Using only the key means all clients with that IP address are removed.
But there could be multiple clients running on the same multi-user
system.
So, use the value as well to remove just the specific one.
This also fixes a bug where, when a client disconnects, all of the
connections are removed from the client's map, but only _one_ is removed
from the GUI.
Task-number: QTBUG-108873
Change-Id: I87da862e8f337fd9c246ff5a2d243e514076fa5f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
It is a best practice after all
Task-number: QTBUG-108873
Change-Id: I11c23c080f6fe7f124e461affa88279d5def93f9
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Where possible
Task-number: QTBUG-108873
Change-Id: I8125ffd63cd0ad1970575fb1a6b85021c03c38d5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Prefer own headers, avoid full-module includes
Task-number: QTBUG-108873
Change-Id: I4282d4aab5fd66c64fc27cd130b223d33069d80f
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Instead of duplicating the long-ish implementation, simply pass the
variant as pointers to const and mutable, and implement a runtime
version of std::forward.
[ChangeLog][QtCore][QObject] Added setProperty() overload taking an
rvalue QVariant.
Fixes: QTBUG-113281
Task-number: QTBUG-112762
Change-Id: Ifdc8f626ad5db138073474c3bd95ec7308c4396b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Some users wish to make layouts with uniform column widths or
uniform row heights, ignoring the sizeHints of individual items.
This patch enables this mode in the QGridLayoutEngine, used
by the QuickLayout.
The sizeHints are aggregated and their average preferred size
and extreme minimum and maximum sizes are respected in the
layout.
Change-Id: Ibb9409eb0a11a1ce8bb305f44a4cb0071c871ec9
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Remove commas at the end of the lines.
Pick-to: 6.5
Change-Id: Idf731ac5de64787276c1fdf798eb429b8f73213b
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Fix reading ranges from metadata when there are multiple RANGE
elements in the metadata.
Pick-to: 6.5
Change-Id: I1d176ded539c55ce72664c9c7c3f65d694be898c
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Don't stop searching enums if the enum partially matches.
Pick-to: 6.5
Change-Id: Idc2b45cee5a32994d55fe90c038938f0ad8b4a59
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Currently some libraries created by Qt are lacking some compile
definitions and compile options, and this issue is causing us
troubles when building Qt statically. This patch tries to reduce
the parameter difference when compiling Qt's own libraries.
Change-Id: I3842943a874fab32ef90980e8aa29f5beb01feeb
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
The desktop file name should not contain ".desktop" suffix, but some
applications still specify it anyway because of the ambiguity in the
documentation that was fixed in
0c5135a9df.
This change makes setDesktopFileName remove ".desktop" suffix so
desktopFileName always returns a desktop file name with correct format
and its users don't need to chop ".desktop".
Pick-to: 6.5
Change-Id: If5abccaf3bf976449cada8891fff887870e45b5f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
1. Don't reassign different versions to same symbol
2. Define symbols used
This fixes warnings with LLD linker (or errors if -Wl,--fatal-warnings is added by toolchain e.g. with Android NDK)
3. Add -Wl,--version-script to CMAKE_REQUIRED_LINK_OPTIONS instead of CMAKE_REQUIRED_FLAGS to prevent unused argument warning in compilation phase
(there is no need for _SAVE variable because we are inside a function and our CMAKE_REQUIRED_LINK_OPTIONS won't escase its scope)
4. Fix removal of version script file (incorrect file name was used)
Pick-to: 6.2 6.5
Task-number: QTBUG-111514
Change-Id: I0a1548c4268ad511760a0d4aa69ba7a0bdcbb0bc
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This patch relaxes the requirements on the context object of
continuations. Instead of having to stay alive during execution of the
whole chain, it now only has to stay alive during setup of the chain.
If the context object is destroyed before the chain finishes, the
respective future is canceled.
This patch works by using QFutureCallOutInterface and signals instead
of direct invocation of the continuation by the parent future, similar
to how QFutureWatcher is implemented.
If a continuation is used with a context object, a QBasicFutureWatcher
is connected to the QFuture via a QFutureCallOutInterface. When the
future finishes, QBasicFutureWatcher::finished() triggers the
continuation with a signal/slot connection.
This way, we require the context object to stay alive only during setup;
the required synchronization is guaranteed by the existing event and
signal-slot mechanisms. The continuation itself does not need to know
about the context object anymore.
[ChangeLog][QtCore][QFuture] Added support for context objects of
continuations being destroyed before the continuation finishes. In
these cases the future is cancelled immediately.
Fixes: QTBUG-112958
Change-Id: Ie0ef3470b2a0ccfa789d2ae7604b92e509c14591
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Create tests to check that the continuations attached to ready futures
are immediately executed, and that the proper handlers are selected.
These checks were missing from the overall test set, which was detected
while working on the linked issue.
Task-number: QTBUG-112958
Change-Id: Iae97e4b9dfb1e016869693a5162f72e027ca7f5e
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This should be better than returning unknown if xdg-desktop-portal
is not running or its backend doesn't know color scheme
This also matches the pratice of all other
QXdgDesktopPortalTheme methods
Pick-to: 6.5
Change-Id: I352e091a019bc5b683c3f1dad223e55717888d02
Reviewed-by: Jan Grulich <jgrulich@redhat.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
To ensure the correct invocation of the projection function, this patch
introduces the usage of std::invoke for all accesses to it. This
modification expands the coverage to include cases where the callable
object is a pointer to a member function.
Amends: 7ca633d9a8.
Change-Id: If666012d785ac74c8e856ea9be2a46b3307c8a06
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
The previous implementation of iterator-assign did not include a check
for the return value of QArrayData::allocate(~), which returns a nullptr
on failure.
Amends: bbbe5f45c4.
Change-Id: I219e63ecd6de4225364d9c3dd2006ddbbe47068f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Buffer and texture sizes (size, pixelSize) may get increased, if needed,
but those actual sizes calculated by the QRhi backends are not written
back to the QRhiBuffer m_size or QRhiTexture m_pixelSize.
In contrast, both m_depth and m_arraySize are clamped in QRhiTexture
by most backends (to ensure a lower bound of 1 and 0, respectively).
This is not great since it means the getters for depth() and arraySize()
may return values different from what the user has provided. To avoid
confusion, do not modify the m_* variables.
Change-Id: I2cc5b9abf41ea108549ffd7f2403306e6e8ebba2
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
Mainly for completeness, but it has practical uses: someone retrieving
a QRhi instance from somewhere should be able to tell the
QVulkanInstance, and so the VkInstance, used by that QRhi without
resorting to investigating other objects (e.g. retrieving the instance
from the QWindow). This provides symmetry to other 3D APIs and QRhi
backends where just a single QRhi instance is sufficient to get the
MTLDevice, ID3D11Device/Context, etc. i.e. all that is needed to
work with the 3D API directly.
Change-Id: I5a8b9871a543ea648c76b868bf6ff7be5f2098f2
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Otherwise individual sockets will still load system certificates when
a chain doesn't match against the configured CA certificates.
That's not intended behavior, since specifically setting the CA
certificates means you don't want the system certificates to be used.
Follow-up to/amends ada2c573c1
This is potentially a breaking change because now, if you ever add a
CA to the default config, it will disable loading system certificates
on demand for all sockets. And the only way to re-enable it is to
create a null-QSslConfiguration and set it as the new default.
Pick-to: 6.5 6.2 5.15
Change-Id: Ic3b2ab125c0cdd58ad654af1cb36173960ce2d1e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Use the new "/Ob3" flag introduced in VS2019 to increase the inline
level, which may give better performance. For compilers older than
VS2019, we still use the traditional "/Ob2" inline level.
Official documentation:
https://learn.microsoft.com/en-us/cpp/build/reference/ob-inline-function-expansion?view=msvc-170
Change-Id: I34a50f27a151cb7c09f0085dd037a385c71848aa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
I.e. if def.superclassList is empty, calling checkSuperClasses() is
no-op. Spotted by Fabian in code review.
Change-Id: I499baf1d2cf6dd08a26394221a48af991ccea4ad
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Testing for "res_ninit" when WrapResolv.cmake has already checked for
far more complex functions was pointless. Instead, just accept the
library that was found by find_package() as good enough and rename the
feature as "libresolv".
Amends 4a46ba1209 and
68b625901f.
Change-Id: Ib5ce7a497e034ebabb2cfffd1762c0afa2fac6e0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Can't use [=, this], as clang fails to build with:
error: explicit capture of 'this' with a capture default of '=' is a
C++20 extension [-Werror,-Wc++20-extensions]
Change-Id: I8ead9cb493cb1e295aa03386d80af6e83ba8cbb4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>