If the child failed to start, execChild() would (unnecessarily) store -1
in childStartedPipe[1] after writing the failure message to it and
closing that pipe. This had worked for the previous 20 years of QProcess
existence, because that was run in the child process. However, with 6.5
commit e1a787a76e (cherry-picked to 6.4)
we implemented vfork-like behavior, meaning the child would share memory
with the parent and ran before the parent, so startProcess() failed to
close it:
// parent
// close the ends we don't use and make all pipes non-blocking
qt_safe_close(childStartedPipe[1]);
Also updated the docs to account for the fact that this is a vfork()
environment and, moreover, not using the vfork() function from glibc on
Linux.
[ChangeLog][QtCore][QProcess] Fixed a file descriptor leak in QProcess
when running on Linux 5.4 or later, if the executable being run failed
to start (for example, the file for the executable didn't exist).
Pick-to: 6.4.3 6.4 6.5
Task-number: QTBUG-111243
Change-Id: I7f354474adce419ca6c2fffd17481002e4853cc3
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When this code was using QByteArray, whose data() is never nullptr,
the strings presented to the underlying C APIs were always valid NTSs
(nullptr is not a valid NTS).
With QByteArrayView, or with QT5_NULL_STRINGS != 1, this is no longer
the case. Check that all implementations are fine with that.
Pick-to: 6.5 6.4
Change-Id: I78251288a4784440af4a2daf095aed7c53867287
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
... making it just another context.
Well, except the EVP struct has non-trivial SMFs, so adding it to the
union deletes all the union's SMFs, too. To restore them, we need to
give the union a class name (State). Since we anyway need to provide
ctors, inline all init() functions into them.
State having a ctor means we need to call it, with the method
argument, in the Private ctor-init-list. That requires the State
member to have a name.
Since the union thus no longer defines variant members within Private,
move most of the functions that operated on the variant members into
State or EVP to avoid having to sprinkle state./evp.-prefixes all over
the code.
This gives the opportunity to re-share some code that was duplicated
when we dragged #ifdef USING_OPENSSL3 out of the functions into
namespace scope. The move of the functions into State robs them of
their access to other Private members, to wit, 'method' and 'result',
so we have to pass them as arguments now.
I tried to split this up into smaller patches, but it kinda has to
happen all at once, sorry.
Pick-to: 6.5
Change-Id: If864d4d46075d00420f6e849cd68c4b824c1a50a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
... and move the evp_{init,reset,finalizeUnchecked}() functions into
it as new members without the evp_ prefix. Need to pass QCHPrivate
members as function arguments now.
This is in preparation of moving these members into the union.
Pick-to: 6.5
Change-Id: I64805d8aac91f777fbc5c13b1a08b37e5227169a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
These, too, will end up on different classes, eventually. The
addData() function is the odd one out here, as it's EVP part it
trivial.
Pick-to: 6.5
Change-Id: I24c7334edd8ba218e4cfcb64d0ed67bc281c4525
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
... by defining separate init(), reset(), addData() and
finalizeUnchecked() functions instead of doing #ifdef'ery inside the
function bodies.
The purpose of the exercise is that these functions will later end up
in different classes. For now, we can already drop the UINT_MAX loop
for the OpenSSL30 case, as both EVP_DigestUpdate() and the Blake
functions use size_t lengths in the API.
Pick-to: 6.5
Change-Id: I9ad618c90bb54b429db3225061cd5cfd25243fca
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Before the OpenSSL3 mode was added, these operations were the
same. The placement-new of the active union member was arguably not
even necessary, as just naming it should start their lifetime;
certainly all initialization was vacuous, anyway. So it didn't really
matter that we re-did it on each reset().
But OpenSSL3 mode is different: initialization allocates (and can
fail) whereas reset() does not¹, so it makes sense to separate them,
so as to re-establish the lost proper noexcept'ness of reset().
¹ or so we assume
This will also help when moving the EVP members into the union later.
Pick-to: 6.5
Change-Id: Id1c9a00cddb95fb2235162409c2301dd4c35228a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
EVP_MD_CTX_reset() alone is not sufficient. A following
EVP_DigestUpdate() crashes, so re-init the context, too.
Amends 189444d8c4.
Pick-to: 6.5
Change-Id: I5dede0adddd7f6b0c62540f6d45917b3236e3d02
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This is the last method that can and should be noexcept:
- the ctor allocates the Private, so can't be
- static hash() allocates QByteArray::data(), so also cannot be
- ditto result()
All other functions are already noexcept.
Fixes: QTBUG-111688
Change-Id: I237c3d1292452da5ca92712531c3527c1fb2f59b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The class is not used frequently enough to warrant the overhead of a
Q_WEAK_ QByteArray overload to fix the SiC Type A for users that pass
objects that implicitly convert to QByteArray, esp. since we'd need
_four_ overloads to handle the two byte array arguments here, and
still cause ambiguities, because there's only one level of "weakness"
in Q_WEAK_OVERLOAD, but we'd need two. QCryptographicHash::hash()
also doesn't have it.
[ChangeLog][QtCore][QMessageAuthenticationCode] The constructor,
setKey(), addData() methods as well as the static hash() function take
arguments by QByteArrayView instead of QByteArray now.
[ChangeLog][Potentially Source-Incompatible Changes] More APIs now
take QByteArrayView instead of QByteArray. You will now get a compile
error when your code passes to such functions objects that implicitly
convert to QByteArray, but not QByteArrayView. Wrapping such arguments
in QByteArray{~~~} to make the cast explicit is a backwards-compatible
way to avoid this problem.
Fixes: QTBUG-111676
Change-Id: Iaff832df3b315ca2eee7bff93720b6681182036f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The class is not used frequently enough to warrant the overhead of a
Q_WEAK_ QByteArray overload to fix the SiC Type A for users that pass
objects that implicitly convert to QByteArray. QCryptographicHash also
doesn't have it.
Also mark addData() noexcept. Now that it takes a view instead of
an owning container, it only calls other noexcept functions.
Make the new overload carry actual documentation instead of just
\overload.
ChangeLog will be on patch [3/3].
Task-number: QTBUG-111676
Task-number: QTBUG-111688
Change-Id: Ie6447bf54d7d442b1a76761bc0f28f868c08ef09
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The class is not used frequently enough to warrant the overhead of a
Q_WEAK_ QByteArray overload to fix the SiC Type A for users that pass
objects that implicitly convert to QByteArray. QCryptographicHash also
doesn't have it.
Also mark setKey() noexcept. Now that it takes a view instead of
an owning container, it only calls other noexcept functions.
ChangeLog will be on patch [3/3].
Task-number: QTBUG-111676
Task-number: QTBUG-111688
Change-Id: Ic2321d0d41ce8eb4d0390889f28b3fd4bd9af103
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Convert tagged pointer to an encapsulated tagged pointer type, and clean
up where it is used.
Change-Id: I9cf5b8d1dfa345eebaa185e44d762d5008769480
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Copying the QSqlDatabase pointer inside QSqlDatabasePrivate::copy() is
not a good idea since it must point to the owning instance and not
another one. Since it's not used anywhere we can safely remove it.
Change-Id: Ie45b594305059afd9b8d8b25d4864dd77769acf7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
It's a teeny-tiny picture of some FTP example that was likely removed
for Qt 5. At the very least it happened before I joined Qt.
Pick-to: 6.5
Change-Id: I85a9fcffc35ad63e355cf4d3dd784d4ed7ca2872
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
We are trying to find the first time in the list that has not expired.
Drive-by change: fix a narrowing conversion warning
Change-Id: I9e5f95b0f9d767f1fda9061c928e3182f4be6a85
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
It's not just that these are not fatal, but some "errors" are
not actual errors, e.g. getting "Nothing to serialize" from Metal
is not something we care about.
Convert them from qWarning to qCDebug with our standard category,
so they still all show up when running with QSG_INFO=1, but won't
pollute the output for regular users. Even if a cache file cannot
be used or written, that's not something typical users care about.
Pick-to: 6.5
Fixes: QTBUG-110485
Change-Id: I63d815f7b95c4d6a4428497b7247811e860ebf04
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
QCryptographicHash is move-only these days, so
QMessageAuthenticationCode should not be left behind.
[ChangeLog][QtCore][QMessageAuthenticationCode] Added move
constructor, move assignment operator and swap() function.
Fixes: QTBUG-111677
Change-Id: I420f24c04828e8ad7043a9e8c9e7e2d47dd183e0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Deals with:
* unknown class name 'Object'; did you mean 'QObject'?
* use of undeclared identifier 'QTimer'; did you mean 'QTime'?
Pick-to: 6.5
Change-Id: Id63064e70090ed1f816fa19db047b382220d634c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
The EDID 1.4 spec states that string descriptors with length less than
13 are terminated with \n and padded with spaces. Since we sanitize the
string by replacing non-printable characters with '-', we can't start
out by replacing \n and \r with \0 to simulate a zero-terminated string,
as these null bytes will then be replaced with '-'. And even if they
were not, QQtring::fromLatin1(QByteArray) in Qt 6 will include any null
bytes verbatim as Unicode null characters, so we'd still end up with
a wrongly parsed string.
We simplify the process by following the spec, truncating the byte array
at the first occurrence of \n (without any check that the following bytes
are pure padding), and then doing the non-printable character replacement.
Pick-to: 6.5 6.2
Change-Id: I9f4e77ddb7b1b759c08b94b29e28d8c148b5435f
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This is private for now. It's very handy to have anonymous properties
for the QML model/delegate adaptors. There are models with only
"singular" model data that doesn't have any sub-properties. Such model
data should be available from the model object via an empty string as
role. This way we can get rid of a lot of special casing.
Task-number: QTBUG-104752
Change-Id: I229e355a7cab064ee1c9f89557bc0244a5d0c90a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
As requested by users. Explicitly stated in the docs that the QImage
is going to be converted, to avoid surprises.
Pick-to: 6.5 6.2 5.15
Fixes: QTBUG-105364
Change-Id: Ia6a8930bcee8bd3cdbef016083599bd435b37a09
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
The existing get<I>() implementations are very clever™, if I, as their
inventor in at least the Qt ecosystem, may say so myself. E.g. the ()
around the return value are absolutely required, to ensure we return
by reference, not by value, through decltype(auto).
C++23 gives us forward_like, which doesn't require the parentheses,
because it always returns a reference.
Also replace decay_t with C++20's remove_cvref_t, the latter being
more efficient (performs less work).
Change-Id: Ic9ed0c25e6d6bfbd77d7c85858a8d97fe58be615
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
instead of if (I == x) return ~~~[x]; just always return ~~~[I].
Pick-to: 6.5
Change-Id: I236159480ab90201f7e3f6f90fdcd1cab5d3a223
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Signals of the vertical scroll bar were blocked when scrolling with
pageUp/pageDown keys or clicking on the scroll range outside the
scroll bar. This has lead to inconsistent signal emissions:
The vertical scroll bar's valueChanged signal was emitted only on
single steps and when the scroll bar was moved with the mouse.
When it was moved in page steps by clicking on the scroll range or
pressing pageUp/pageDown, it was not emitted.
This patch removes the signal blocker for page step movements, which
was added in 94fd108ea4 to replace
explicit calls to blockSignals(), which were added in
c14d442b08ac81327b173b0a220c7b1840667899.
The patch also adds test function to tst_QPlainTextEdit to check if
the valueChanged signal is emitted correctly.
Pick-to: 6.5 6.4 6.2
Fixes: QTBUG-8682
Fixes: QTBUG-25365
Change-Id: I4385a5387c91497f623978e35bbbe3e06f473afe
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
It's not deprecated in 6.4, only 6.5
Pick-to: 6.5
Change-Id: I86a09b9ce5a7f4d8b1d80a6e67218dfe00f93844
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Drive-by changes:
- Cleanup creating a QChar[], by creating a char16_t[] and
reinterpret_cast'ing it
- Use human-readable Unicode characters where possible
Pick-to: 6.5
Change-Id: Ice2c36ff3ea4b6a5562cf907a7809166a51abd28
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Remove a redundant QT_VISIBILITY_AVAILABLE check. Pointed out by Thiago
in review.
Note that this is going to help with breaking include cycles between
qglobal.h and qcompilerdetection.h (otherwise we'd have to include
qtconfiginclude.h in qcompilerdetection.h as the former includes
qconfig.h which defines QT_VISIBILITY_AVAILABLE; without
QT_VISIBILITY_AVAILABLE defined, Q_DECL_EXPORT/IMPORT expands to
nothing on Linux and co., and tools linking to qtcore (with bootstrap)
can't find exported methods.
Change-Id: Ib1244d43e606a6c80e122adea631305f6d8c51d3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is similar to the tryLock() commit, making the chrono overloads the
main methods, this way the lock time isn't limited by the size of int,
but rather by std::chrono::milliseconds (which can be as up to int64_t).
Task-number: QTBUG-110059
Change-Id: I8d1652748b16be2154233f7db57ed485bcab62c7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Cleans up the constructor.
Except for fileHandle member on Windows, initialize it in the
constructor with INVALID_HANDLE_VALUE as before. I don't know why
exactly that makes the build fail on Windows.
Change-Id: I8ade6f35ea6d9b3d31ef369d1f90d145e52ae8fc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Pack some of the arrays that contain locale data more tightly. The
AlphaCode struct is a char[4] but always holds only [a-z]{,3} which
could be fit into 16 bits, halving the size of an AlphaCode struct.
With the new constructor the initialization of the AlphaCode struct
also changes - modify qlocalexml2cpp.py to reflect this change and
regenerate the languageCodeList.
Fixes: QTBUG-105050
Change-Id: I2b1e93ab7cc3f2d667bf67b45769b74a15211931
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Make the error message clearly mention that a Qt for Android app
require linking to Qt Gui library.
Along the way get rid of the libqtforandroidGL mention which
was valid when Qt for Android had separate plugins for raster
and opengl, which was removed some time ago in
8a9bd001c9.
Pick-to: 6.5 6.4 6.2 5.15
Task-number: QTBUG-111933
Task-number: QTBUG-111934
Task-number: QTBUG-108643
Task-number: QTBUG-97636
Task-number: QTBUG-83997
Fixes: QTBUG-85544
Task-number: QTBUG-93185
Change-Id: I24f6c08f619d805e0d82758d35aebaf32038206c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Previous setup of the test was failing in minimal static build if built
using the unity build because of the explicit inclusion of the qtcore
source files. By removing them, it surfaced that QFileSystemEntry
doesn't export all its necessary symbols for testing. So this patch does
that, as well as removing the qtcore sources from the test. It also
makes sense to make the test private.
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Icdabe32485b7ce4ed6049bcc24918f531406b4bd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
The signal has been emitted also, when the slider position has changed
without a value change (e.g. on QWidget::show() or on resizing).
This patch stops emitting the signal without a value change.
It adds a verification to tst_QAbstractSlider::setValue(), that
valueChanged is not emitted on a no-op value change.
As a drive-by, the patch removes an unnecessary assignment and
changes signal spy constructions to PTMF syntax.
Pick-to: 6.5 6.4 6.2
Task-number: QTBUG-25365
Change-Id: I9932e45d4e680aa53422ca75aa42a16306213a38
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
There was a possibility of infinite loop and eventually crash when
androiddeployqt was used for the second time. Everything because of
deleteMissingFiles function for clean up previous build.
When we find the same names and those are directories, we call
recursively deleteMissingFiles. The parameters we use are absoluteDir,
not absoluteFilePath. As we use parent of found dir, deleteMissingFiles
is called with the same values as before.
This commit removes possibility of infinite loop by using
absoluteFilePath. That allows to avoid calling deleteMissingFiles with
the same parameters.
There is still a possibility, that directory that was found is not the
same as we were looking for. That will cause not needed files removing,
but those file will be copied again later.
This regression was created by 7dc05252a0
commit
Pick-to: 6.5 6.2
Fixes: QTBUG-111027
Change-Id: I195b4c407068b14e2ef94800ad1945adc66408cb
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
For each QWasmWindow, there is "Enable screeen reader" button added
for accessibility. It's hidden visually by z-ordering behind main
QWasmWindow div.
Sometimes the content of QWasmWindow contains transparent elements
and the underlying accessibility button gets visible.
This commit introduces new CSS class which hides elements visually,
but keeps it accessible for screen readers.
Fixes: QTBUG-111896
Change-Id: I78ef5746da9e0d1584ee36dd0ca6ba476623a3de
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
I.e. tryLock(chrono::milliseconds) shouldn't call the int overload as
that truncates the timeout (milliseconds is typically int64_t).
Add a note to the tryLock(millisecons) docs that passing
milliseconds::max() will make it wait forever to obtain the lock.
Task-number: QTBUG-110059
Change-Id: Ib48d9b1b117ce816348625331543d6ba8a788973
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QCompleter::setPopup() sets window flags, focus policy, parent, focus
proxy, item delate and installs an event filter, before the popup
argument is assigned to d->popup.
In the QCompleter::eventFilter override, QObject::eventFilter is called
(under more) if d->popup is nullptr.
If a custom class is inherited from QCompleter and it overrides
QObject::eventFilter(), this causes an infinite loop.
This patch re-factors the method.
- early return is added if the new popup != d->popup
- remembering the existing widget's focus policy is constified and
moved ahead of the delete secion.
- assignment of d->popup to popup argument is moved after the delete
section.
- after assignment, the argument variable is no longer used.
The refactoring eliminates two issues:
- potential risk of double-installing event filter due to missing
early return.
- inifite loop if inherited class installs another event filter.
The patch adds a test function to tst_QCompleter, which implements an
inherited class, installs an event filter on a popup and checks if a
ChildAdded event hass been recorded.
Fixes: QTBUG-111869
Pick-to: 6.5 6.2
Change-Id: I3f7a2434a11476077a5260e7686a912da9f6c60d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Add support for QPlatformWindow::setOpacity() in QWasmWindow.
Change-Id: Ib54cecf1f49e3d576a386f4109b8c6df1f16f312
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Use WEBP format to reduce the file size.
Task-number: QTBUG-111366
Pick-to: 6.5
Change-Id: I14ff15010e7ac7e1b375eeafaa1c153b0fdd95e6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This check was accidentally removed in commit 783b63ce.
If the cursor is null, set the default cursor.
Pick-to: 6.5 6.5.0
Change-Id: I894d5e04cd7b49041bd0d3b59fc816a8b7efffe7
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
- Removed the NO_UNITY_BUILD argument from commands that disable it by
default.
- Add a warning in case NO_UNITY_BUILD or NO_UNITY_BUILD_SOURCES is
being used where it is already disabled, e.g., qt_internal_add_test
- Exclude all sources of a target from unity build if NO_UNITY_BUILD
is set on the target. This sounds a bit harsh, but I have noticed that
sometimes the same source file can be included somewhere else, and
some unexpected collision may occur.
- qt_examples_build_end excludes all its examples from the unity build.
- qt_build_test now sets the CMAKE_UNITY_BUILD to OFF before configuring
the tests, and restore its value when done.
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ia42e7dd5a5bfb151db241deb639325720fd91eec
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Unity build is disabled by default for all 3rdparty libraries, so we
don't need to set the manually anymore; and for the plugins we can use
NO_UNITY_BUILD instead.
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ia2f83ae083924d31adf07e7647b34ae6571ed01f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>