This time, `auto` accidentally copied an atomic instead of making a
local non-atomic copy.
Change-Id: I3c6569f6ea1762e7102e1425346aba6d82bf2b00
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
They're fundamentally broken and should never ever be used.
* op==(weak, weak) is heterogeneous, but at the same time it's
unconstrained (!), may trigger UB (!) by doing a static_cast to a
type which isn't the actual type of the pointee, and may outright
crash (!) if the pointee has been deleted and there's virtual
inheritance.
* op==(weak, strong) compares the control blocks, i.e. does
"owner_equal" comparison, not pointer comparison. Now QSP doesn't
have support for aliasing, so the pointers stored by the smart
pointers themselves always point at the owner object.
Yet: given a QSharedPointer<T> that is the last owning pointer to T
and a QWeakPointer<T> that tracks it, if one resets the shared
pointer, then op==(wp, sp) will yield false (wp still points to the
control block, sp does not), but op==(wp.lock(), sp) will yield
true (both shared pointers are null). That doesn't make any sense.
I'm leaving op==(wp, std::nullptr_t) in as a shorthand to check if the
weak pointer is expired, but might deprecate that as well in a future
commit.
[ChangeLog][QtCore][QWeakPointer] The (in)equality operators of
QWeakPointer have been deprecated. Always upgrade a QWeakPointer to a
QSharedPointer (for instance, via lock()) before doing a comparison.
Change-Id: Ia2f5f5e9e5558e1558b6084542532515c80b78b0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
[ChangeLog][QtCore][QStringList] Added lastIndexOf() overloads that take
a QString/QStringView/QLatin1StringView and a Qt::CaseSenitivity
parameters. Prior to this calling lastIndexOf() would call the methods
inherited from the base class. This change is source compatible and
existing code should continue to work.
Task-number: QTBUG-116918
Change-Id: Ia50c884c00021bf581c23c12e0e0c22700dae446
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
[ChangeLog][QtCore][QStringList] Added filter(QLatin1StringView)
overload, which is more optimized when searching for a Latin-1 string
literal as no conversion to QString is necessary.
Task-number: QTBUG-116918
Change-Id: Ieb92f4cfd545b070258dbc5c701ddfb2e6f3fc64
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
[ChangeLog][QtCore][QStringList] Added indexOf() overloads that take
QString/QStringView/QLatin1StringView, and a Qt::CaseSensitivity
parameter. Prior to this using QStringList::indexOf() called the methods
inherited from the base class.
Task-number: QTBUG-116918
Change-Id: Ibc42130b6509f6ecfe7de0d6be378f226ae61982
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Now that users can pass a QStringMatcher to do the matching, change the
existing overload to not use QStringMatcher.
Thanks to Giuseppe D'Angelo for the idea of passing a QStringMatcher to
filter instead of using a magic number to decide whether to use
QStringMatcher or not.
Results of running filter() and filter_stringMatcher, times are in msecs
and this was compiled with gcc -O3:
Without With QStringMatcher
list10 0.00022 0.000089
list20 0.00040 0.00014
list30 0.00058 0.00018
list40 0.000770 0.00023
list50 0.00094 0.00027
list70 0.0012 0.00037
list80 0.0014 0.00041
list100 0.0018 0.00050
list300 0.0054 0.0014
list500 0.0091 0.0023
list700 0.012 0.0032
list900 0.016 0.0041
list10000 0.17 0.045
Drive-by change: optimize tst_QStringList::populateList().
[ChangeLog][QtCore][QStringList] Added filter(const QStringMatcher &)
overload, which may be faster for large lists and/or lists with very
long strings.
[ChangeLog][Possible Performance Changes][QtCore][QStringList] Changed
the implementation of filter(QStringView) overload to not use
QStringMatcher by default. Using QStringMatcher adds overhead, so it is
beneficial/faster when searching for a pattern in large lists and/or
lists with long strings, otherwise using plain string comparison is
faster. If using QStringMatcher makes a difference in your code, you can
use the newly added filter(QStringMatcher) overload.
Change-Id: I7bb1262706d673f0ce0d9b7699f03c995ce28677
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Invalid are usually those mounted on a filesystem we can't access:
$ df /run/user/0/gvfs
df: /run/user/0/gvfs: Permission denied
$ ./qstorageinfo /run/user/0/gvfs
Could not get info on /run/user/0/gvfs
df already doesn't include it by default:
$ df | grep -c gvfs
0
But we were:
$./qstorageinfo | sed -n '1p;/gvfs/p'
Filesystem (Type) Size Available BSize Label Mounted on
gvfsd-fuse (fuse.gvfsd-fuse) RW 0 0 0 /run/user/0/gvfs
Note also how this is showing a total size of 0, which is usually the
type of filesystem we exclude. It's actually -1 but got rounded down to
0 when we divided by 1024.
Pick-to: 6.6
Change-Id: I8f3ce163ccc5408cac39fffd178d7e4f9dc13b24
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
This function is only called with the name of a file coming from
QFileInfo::fileName() so it's usually already detached anyway. And if
there's nothing to decode, pass the string through without even
attempting to modify it.
Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1787651437074d35
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Instead, create a (flat) map of the entries that we can seek on while
creating the list of mountedVolumes(). On my machine, that went down
from 14 times to 1.
Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd17875458541f28f9
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Instead of the previous realpath() comparison resulting from the symlink
processing. parseMountInfo() was extracting the device number from
/proc, so this information was already readily available.
We must take care of anonymous block devices (major == 0). Certain
filesystems, such as btrfs, always use them, so we must still stat() the
device path to get the real block device.
This implementation assumes that udev only creates entries in the
/dev/disks/by-label directory that are symlinks to real devices, but
that must already be the case because they are in /dev in the first
place. An alternative implementation would be to compare the inode and
host device (st_dev) of the entry, if different /dev entries could have
different labels. I don't think that's possible. But multiple /dev
entries for the same device is definitely possible.
Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1787552af3d09676
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This fixes a similar problem as the previous commit. Because Linux
allows one to mount over non-empty paths, it's possible to make
mountpoints unreachable, and yet they will still be present in the
/proc/self/mountinfo listing. Because we have the device ID from the
scan, we can confirm that the mountpoint matches the MountInfo.
# mkdir -p /tmp/foo/bar
# mount -t tmpfs /tmp/foo/bar
# mount -t tmpfs -o size=1M /tmp/foo
# mkdir /tmp/foo/bar
$ ./tests/manual/qstorageinfo/qstorageinfo | awk 'NR==1 || /tmp\/foo/'
Filesystem (Type) Size Available BSize Label Mounted on
tmpfs RW 1024 1024 4096 /tmp/foo
Change-Id: I79e700614d034281bf55fffd178f8b99b10a8b69
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Linux allows admins to mount new filesystems over non-empty paths
(though I managed to do so on FreeBSD and macOS too), so we must find
the most recent mount that applies to this path instead of the longest
matching mountpoint. We do that by scanning the /proc/self/mountinfo
list backwards and thus any matching isParentOf() must be the correct
one.
# mkdir -p /tmp/foo/bar
# mount -t tmpfs tmpfs /tmp/foo/bar
# mount -t tmpfs -o size=1M tmpfs /tmp/foo
$ ./tests/manual/qstorageinfo/qstorageinfo /tmp/foo/bar
Filesystem (Type) Size Available BSize Label Mounted on
tmpfs RW 1024 1024 4096 /tmp/foo
But we must guard against an earlier mount still being (somehow)
accessible. We've seen this in the CI, where /run is earlier than / but
still somehow accessible -- I guess this is one or a pair of mount
--move.
An additional benefit is that don't even attempt to compare to the
virtual filesystems mounted by the system early after boot, if what
we're looking for isn't the root.
See next commit for a fix for QStorageInfo::mountedVolumes().
Change-Id: I79e700614d034281bf55fffd178f8befc5e80edb
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Otherwise we have no way of knowing which QStorageInfo entry was being
tested.
Previous:
FAIL! : tst_QStorageInfo::storageList() 'other.isValid()' returned FALSE. ()
Now:
FAIL! : tst_QStorageInfo::storageList(/run/user/0/gvfs) 'other.isValid()' returned FALSE. ()
Change-Id: I8f3ce163ccc5408cac39fffd178d786e596ece81
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
When a child window is made visible without its parent having been
created yet, we defer creating and making the child visible until
the parent is created.
But if a child window is explicitly created, we create the parent
first. And creating the parent will in turn apply visibility to
all children that had their visibility deferred. Which includes
creating the child.
This results in child -> parent -> child creation recursion,
which means that when we return from creating the parent window
we already have a platform window for our child, and should
bail out.
Pick-to: 6.6 6.5
Change-Id: I11dc4864b57f031de2cca70b79cdfc057d4fbd0d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
The existing pattern() method always returns a QString, which means that
if the matcher was constructed using a QStringView, pattern() would
uncoditionally convert it to a QString.
This is useful to check if a match is exact:
auto pattern = matcher.patternView();
if (pattern.size() == needle.size() && matcher.indexIn(needle) == 0)
....
This may be needed for a later change in QStringList::contains();
regardless of that, this change makes sense on its own.
Change-Id: I49018551dd22a8f88cf6b9f878a5166902a26f58
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
errno should be queried immediately after a libc function call fails,
calling it later on in QSystemError::stdString() may be too late.
Part of the goal of this, and similar, changes is removing the default
value of the stdString() method's parameter, to signify to users of that
method that errno should be stored ASAP if there is an error.
If there is any intervening code that may call a system/libc function
store errno in a local int var, otherwise use it directly in the
QSystemError::stdString() call, which takes by value.
Task-number: QTBUG-115199
Change-Id: If3f601a023ed0014e260089771220668dad88be8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Amends 1399b3ccce -- this one just slipped through the cracks.
Change-Id: I72c6c93b85cc609546fbd2af7c9a80f3ac360ee2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
When running on operating systems that don't offer modern APIs, we need
to round up to ensure we don't under-sleep and wake up before the timers
actually expire. In most cases, this is not a big deal because we'd go
right back to sleep and then wake up again.
The problem is that this new sleep would be for a duration of 0
milliseconds, so we'd end up busy-waiting until the timers do expire.
It's for less than 1 ms, but it's still power-consuming.
It's also perceptible when someone uses processEvents(), because we
could end up saying we didn't process anything, despite waiting for more
events. Since that violates the guiding rule for processEvents() (don't
ever use it), I don't consider this a big deal.
Fixes: QTBUG-118199
Pick-to: 6.5 6.6
Change-Id: I79e700614d034281bf55fffd178f0611be96bfa7
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Simplify removeAnimation by directly passing the pointer to remove to
the function instead trying to figure them out later on and relying on
QObject::sender().
Change-Id: I9de3a138c60b0da8dd1ab23fe8521798b7f4c13c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Use pmf-style connect in QCommonStyle and remove the unused function
animationTargets() as a drive-by
Change-Id: I60e361ab00429a95eeab8799743996cea3f1469a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Use pmf-style connect in QStyleSheetStyle. styles subdir is now
old-style connection free.
Change-Id: I926ff308a823212b0512328b96dd6779d6cb30fa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
The !enabled branch does nothing so it can be safely removed. Also
remove the unneeded documentation since it's a simple reimplementation
from the base class.
Change-Id: Iea6e77ab42b09a30f73ae2f1f671eb4198a31c41
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Remove superfluous explicit function prototypes in documentation, and
remove the unused QJniScopedLocalRefPrivate specialization of
QScopedPointer<_jobject>.
Change-Id: I6407522746bc9756cdaceea8e0e0a32d0830eeee
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Amend 80d4d55e25. It should not be
possible to convert a QJniArray<jobject> to e.g. a QJniArray<jstring>,
so SFINAE out any construction that would convert between unconvertible
element types. To prevent the fall-back to constructing from QJniObject,
make those constructors explicit, which they should have been anyway.
Change-Id: I17fd9dfcea425a7bfa34d7bef736bab2be42a536
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Add an overload for fontTable (we can't deprecate the const char *
overload as it will be used for string literals, even if the tag-
overload would work), and use the tag type in the test instead of
QByteArray.
Task-number: QTBUG-117046
Change-Id: I104f11a25e9c453a5d1081b6cf320bdc186b7e80
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Replace the local MAKE_TAG macro definition with QFont::Tag's support
conversions to and from big endian byte ordering.
Also replace the incorrect usage of the big-endian-producing MAKE_TAG
macro in the DirectWrite implementation. The IDWriteFontFace
documentation suggests to use the DWRITE_MAKE_OPENTYPE_TAG macro for
producting the tag, which is equivalent to the LittleEndian
implementation of QFont::Tag::value.
Task-number: QTBUG-117046
Change-Id: I1e522c1c6006b8bcf66110bd74a36a42ed28f7e4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Instead of overloads and generic string literals with runtime checks,
use a dedicated Tag type for specifying the font feature. The Tag type
can only be instantiated with a string literal of exactly 4 characters
(plus the terminating null)l; longer or shorter literals result in a
compile time error.
Constructing a Tag from any other string type is possible through the
named fromString constructor, in which case we can only check the length
and warn at runtime.
The type's API is almost completely constexpr so that we can use it to
calculate e.g. enum values.
Task-number: QTBUG-117046
Change-Id: I31038c7c6fd2b843a105b032f021e506b0b60822
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
... by checking if SECBUFFER_APPLICATION_PROTOCOLS is defined.
In this case, we assume that the current environment supports ALPN.
Then we no longer do a blanket block for all mingw configurations.
Pick-to: 6.6
Change-Id: I2eedb813a5bdc3b1a5097053b04aa45d25d175aa
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The declaration was moved out of the #if QT_CONFIG(openssl) block at
some point, but the definition was not. This caused compilation errors
when building without OpenSSL configured.
Pick-to: 6.6 6.5
Change-Id: I41ed85fd57f5a912498e0f2517761b81a7b8673c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Partly because it also saves to CBOR, but also because our guidelines
say to avoid using "Example" in the title.
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Id858475a6b0474228cfe8044e188cc763f56e3a8
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Since these functions perform the same operation as the base class
QAbstractProxyModel, we can use the counterparts of the basic class
directly to keep the implementation clean.
Change-Id: Ie16a988f5ad25eb202351713e6aee73df266209b
Reviewed-by: David Faure <david.faure@kdab.com>
Same problem, and same solution, as in
0f0371c830.
Pick-to: 6.6
Change-Id: I79e700614d034281bf55fffd178f56772b09cf25
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Use the new function to convert into a QVLA instead of first
converting to a QString and then to a QByteArray. One conversion and
one buffer instead of two each.
Pick-to: 6.6
Change-Id: Ieaa24c8ef325797b5a89e8da0ca4310667c00fa7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Define color groups used for shading and in order to render specific
inactive texts, e.g. menu item text.
Found-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Pick-to: 6.6 6.5
Change-Id: I736f5aff1ff5379ce3f78b53e547b0b5f552779f
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Instead of creating a temporary QJniEnvironment for each access to the
array, reuse the one stored in the QJniObject. This is much more
efficient, and also protects against invalid access to the array from
multiple threads.
Change-Id: Id253a51ca64d4b3af333b14ec62ae176e1663604
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This is purely cosmetic, to avoid confusion when reading the logs and
find many "FAIL!" strings all over the place. The ASAN testrun only
cares for "ERROR: AddressSanitizer" type errors, and tests pass even
if they print "FAIL!" (that is taken care by sanitizer-testrunner.py).
Fixes: QTQAINFRA-5896
Pick-to: 6.6 6.5
Change-Id: Ib7a5fb2c3ee56581db20efb4dd7cf24a053d5c13
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
While a minor issue, it's possible to use them in a way requiring
a definition, triggering a linker error. We can either make them
inline or constexpr.
Pick-to: 6.6 6.5
Fixes: QTBUG-118170
Change-Id: Ia3dede91b989b295c3e792691d534648581a27c2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Calling std::mutex::try_lock() when the mutex is already owned by
the thread casuses undefined behavior.
Change-Id: I024ced271cad8a034bebf80b48e31e7e7461c560
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
[ChangeLog][Android][Deployment Changes] Now the auxillary mode
of androiddeployqt also copies the templates and the stdcpp lib
file without building the APK.
Fixes: QTBUG-115241
Change-Id: I3d4647277e7f62f079c683645443462ef8026948
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
For those that simply repeat or skip a whole calendar day, life is
fairly simple. However, Alaska's 24-hour transition at 15:30 LMT Sitka
(incidentally combined with a change of calendar) is a bit trickier.
Also fix a typo I noticed in passing.
Write tests to determine what the actual behavior is and document
enough to make the actual behavior seem unsurprising once encountered,
without trying to go into all the excruciating details. Naturally, MS
time-zone data lacks the data on the historic transitions involved in
these tests, so MS (when not using ICU's time-zone data) is excluded.
It seems Cupertino believes Alaska was always in the USA, too.
Change-Id: Ia638c04d2ffc3a956a70a2a85badb7bbfdbb791c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Previously, requesting a time that got repeated - on the given date,
due to a fall-back transition - would get one of the two repeats,
giving the caller (no hint that there was a choice and) no way to
select the other. Add a flags parameter that captures the available
ways to resolve such ambiguity or select a suitable time near a gap.
Add such a parameter to relevant QDateTime methods, including
constructors, to enable callers to indicate their preference in the
same way. This replaces DST-hint parameters in various internal
functions, including QTimeZonePrivate's dataForLocalTime(). Adapted
tst_QDateTime to test the new feature.
Adapt to gap-times no longer being invalid (by default; or, when they
are, no longer having a useful toMSecsSinceEpoch() value). Instead,
they don't match what was asked for. Amend documentation to reflect
that. Most of the code change for this is to QDTParser and QDTEdit.
[ChangeLog][QtCore][QDateTime] Added a TransitionResolution parameter
to various QDateTime methods to enable the caller to indicate, when
the indicated datetime falls in a time-zone transition, which side of
the transition to fall or whether to produce an invalid result.
[ChangeLog][QtCore][Possibly Significant Behavior Change] When
QDateTime is instantiated for a combination of date and time that was
skipped, by local time or a time-zone, for example during a
spring-forward DST transition, the result is no longer marked invalid.
Whether the selected nearby date-time is before or after the skipped
interval may have changed on some platforms; unless overridden by an
explicit TransitionResolution, it is now a date-time as long after the
previous day's noon as a naive reading of the requested date and time
would expect. This was the prior behavior at least on Linux.
Fixes: QTBUG-79923
Change-Id: I11d5339abef9e7125c4e0dc95a09a7cd4f169dab
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>