Let's take the beginning of the description: WaitForSingleObjectEx can
be up to 16 milliseconds early. This is proven by the fact that there
are tests doing:
wait(waitTime);
QVERIFY(timer.elapsed() >= waitTime - systemTimersResolution);
and failing.
Task-number: QTBUG-59337
Change-Id: Iae839f6a131a4f0784bffffd14a9a79523d69d94
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
When the insertion into the cache fails then it will delete the entry
for us which already calls releaseKey(). So we should not call it a
second time.
Task-number: QTBUG-58259
Change-Id: I816c6f29ef97fe3a245f145c4faf1e0649f72dc5
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
ResultStore never actually exists, only ResutStoreBase does. So casting to
ResultStore<T> and calling its member functions is UB. Put the type dependent
function as template member functions within ResultStoreBase and so we don't
need QtPrivate::ResultStore anymore.
Same goes for the iterator.
Change-Id: I739b9d234ba2238977863df77fde3a4471a9abd2
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
We should not check for platforms, but rather for features. Also, if
dbus is available it doesn't automatically mean that QProcess is.
Change-Id: I27ef5863fcb107cca1aa47abba95b734962adc33
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
For the windows file system engine, we add an extra macro to use
library loading if configured to do so, but avoid it on WinRT, as
none of the symbols would be found.
We also QT_REQUIRE_CONFIG(library) in the library headers and
exclude the sources from the build if library loading is disabled.
This, in turn, makes it necessary to clean up some header inclusions.
Change-Id: I2b152cb5b47a2658996b6f4702b038536a5704ec
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Parameters passed by value, like local function variables, are subject
to NRVO/return-by-move already, so adding std::move, even disguised as
qMove(), makes Clang warn about a pessimizing move.
Change-Id: I7d59bfee4cf7ecddee0874ee489367044c702643
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
QLocale::matchingLocales() simply created each locale using the basic
data, without (unless the matching conditions stipulated Language C)
applying number-options hacks that it applies everywhere else, when
creating the C locale. Thus the C locale in its returned list (if it
wasn't the only entry) ended up with the default number options,
without omiting separators in numbers. Thus QLocale::c() didn't
actually appear as an entry in the list. Discovered while
investigating QTBUG-58947.
Added a dumb autotest that checks various ways of getting the C locale
do actually give us equal locale objects. Fixed matchingLocales() to
apply the same hack as is used elsewhere for the C locale.
Change-Id: I263f31da623052b63171f5b5a83c65802383df21
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
On a multi-display system wide submenu might either appear on wrong
screen or not appear at all (depending on the specific display
configuration).
Task-number: QTBUG-56917
Change-Id: I40013b0bee340a01ae1c08a5e074afa63da4dbfd
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
This patch fixes 2 issues related to wide menus:
1) Menu took on full screen height when menu width was larger than
screen width;
2) On a multi-display system wide menu might appear on wrong monitor
(not the one where show event was triggered).
The idea is we limit parent menu and all its submenus within the screen
where it was opened.
Note that this patch fixes only geometry-related issues and there are
also some style flaws which need to be addressed (for example, currently
the text does not elide if it doesn’t fit to the menu’s width).
Task-number: QTBUG-56917
Change-Id: I7e9ff4a48bf03060d76e34d33a13ad6cc890c133
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
As the destroyed() signal is emitted from ~QObject, it is not allowed
to use static_cast to a QAbstractButton on that pointer anymore.
And the qobject_cast will also fail which will keep a dangling pointer
in the hash.
Change-Id: If0d22fcc30cde87e771e70914c3afb04ea207289
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
C0 to DF take one continuation byte; E0 to EF take two.
It's invalid UTF-8 anyway, but at least this is what the test row meant:
overlong sequence with 3 bytes of what should have been two.
This updates the comment to match the character that we were actually
testing.
Change-Id: I85a8bd6da2c44f52b4e3fffd14a75df2600487aa
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
After commit d207738245 we unconditionally
write version two, but it seems useful to allow users to specify the
version explicitly.
Change-Id: I81d3de3d7f87318653f89bf10e3618becd8329d6
Task-number: QTBUG-58769
Reviewed-by: hjk <hjk@qt.io>
Replace all QT_NO_PROCESS with QT_CONFIG(process), define it in
qconfig-bootstrapped.h, add QT_REQUIRE_CONFIG(process) to the qprocess
headers, exclude the sources from compilation when switched off, guard
header inclusions in places where compilation without QProcess seems
supported, drop some unused includes, and fix some tests that were
apparently designed to work with QT_NO_PROCESS but failed to.
Change-Id: Ieceea2504dea6fdf43b81c7c6b65c547b01b9714
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Unlike setTimeSpec, this forgot to clear the bit when detaching. So it's
possible that some further use of the flags could incorrectly conclude
that the data was short and then proceed to corrupt the pointer.
The example from QTBUG-59061 caused this because toUTC() -> toTimeSpec()
calls setMSecsSinceEpoch which left the bit set; then addDays() calls
setDateTime(), which calls checkValidDateTime() and that corrupted the
pointer. This problem was more visible on 32-bit systems because no
QDateTime was short (except for default constructed ones), but it
can happen on 64-bit with sufficiently large dates.
Task-number: QTBUG-59061
Change-Id: Ibc5c715fda334a75bd2efffd14a562a375a4e69b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The call to trimmed() makes sense for URLs typed in a browser's location bar,
but its use in every code path made it impossible to open a file with a trailing
space in command-line tools that uses fromUserInput(cwd) to handle command-line
arguments, as recommended. For instance kde-open5 "file.txt " would fail.
Change-Id: Ie61182684521d91f077d3e76f95b7240965ab405
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This allows to test specific filenames without polluting the current dir.
Change-Id: Ieb99019a2e37e30f294d85c5d80af1de1b919019
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
operator=, which was only used for clearing, wasn't clearing the hash.
This led to a mismatch between the vector and the hash (given that the hash
points into the vector).
Spotted by interrupting kmail in gdb, and it was in this code
iterating over a 2000 entries hash (the first vector entries not matching
the hash, this code keep appending new entries for the same formats).
This fixes QTBUG-8862 again, the initial fix having been accidentally
reverted in 467b15a.
Change-Id: Ia34b3d002a0199e1930431a4bbdb2ec981ed4ffc
Task-number: QTBUG-8862
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
We define QT_STATICPLUGIN for the plugins in this case, so that they
define the factory functions needed to link them directly into the
test.
Change-Id: I0f2de7bf6bec5a6d53ec9ad92536817c1221b7d5
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
don't attempt to hand-craft a library export any more. instead, use the
configure system's built-in mechanism, and refer to it via QMAKE_USE.
this also allows us to rely on transitive dependencies in the autotest.
as a side effect, this makes the openssl-linked feature imply the
openssl one.
Change-Id: I5dd209b63bc8fbbc62852f6ffc472d4452ea2e68
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Some format and parse tests for time and date-time depended on locale
but had test data for the C locale (so fail if the test-environment
has, e.g., LANG=de_DE@utf8). So impose the C locale (until Qt 6).
The date-time test did *some* attempts at fixing for locale, but
failed to handle am/pm; and we do have "### Qt 6" comments in
Q(Date|Time)+::fromString indicating that we intend to switch these
methods to use the C locale by default (which shall fix this once and
for all). So rip out the incomplete localization now and test we work
properly at least when the locale used *is* C. Add a comment to the
matching QDate test to rip out its (presently adequate) matching code
once we do get to Qt 6 and make fromString() use the C locale.
QDateTimeParser uses systemLocale(), which is initialized the first
time it gets accessed; so we need to frob the locale *early*; doing so
in the test-class constructor is about as early as we conveniently
can; and seems to work (while doing it in individual tests does not).
(There is no point rolling back at the end; the QSystemLocale global
has been set up by then, so the roll-back would merely leave the
global out of sync with setlocale() and the environment.)
Task-number: QTBUG-58728
Change-Id: Ifa6778a80276050a099387a6dab15a1096be7561
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
AİİA.pdf takes 8 QChars, but after lowercasing it takes 10, so the code cannot
assume the length to be the same.
Task-number: QTBUG-58822
Change-Id: Id6fbb99f6afd08ee420099cd66372732d7598d9e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
see 5a1b4832a2 for more detail
Task-number: QTBUG-58142
Change-Id: I51851ea9b4fe7b8eeadc452bc3dbb1ea00026d29
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Like the lvalue QVector::append() overload, when we reallocate,
we need to take a copy of the function's argument because the
reference will get stale upon reallocation.
Add a test.
[ChangeLog][QtCore][QVarLengthArray] Fixed a bug involving
appending an item already in the container to the container
again.
Change-Id: I06eeed6cb383dd5924e47a302bb3d1666d04c8e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Automount filesystems like /home on many operating systems (QNX and
OpenIndiana, at least) don't like if you try to mkdir in them, even if
the file path already exists. OpenIndiana even gives you an ENOSYS
error.
So instead, let's try to mkdir our target, if we fail because of ENOENT,
we try to create the parent, then try again.
Task-number: QTBUG-58390
Change-Id: Ibe5b1b60c6ea47e19612fffd149cce81589b0acd
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
Reviewed-by: David Faure <david.faure@kdab.com>
tst_QDateTime::operator_insert_extract() was setting the time-zone and
taking care to restore it at the end of the test; however, if the test
were to fail, the restore would be skipped. Package the zone-setting
and restore in a class instance, so that premature return can't bypass
the restore.
Change-Id: I3df63260da17e481ef4d0d107d9f0fdea3e147e7
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
We keep the runnables from finishing by having them block
on a QSemaphore::acquire() call inside run().
If we fail a test that precedes the call to sem.release()
further into the test, the early return will cause the
thread pool to be destroyed, which will then attempt to
wait for the runnables to finished, which, in turn wait
for the semaphore to be released.
-> dead lock
Fix by introducing a RAII object to release the semaphore
with a sufficiently large number to unblock all runnables.
That number will in some situations be too large, but that
does not matter.
Change-Id: I1ec7e29b37bc36309e93e6e30708cc7db3c9579c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In order to get reproducible runs of the test, we need to
wait in the main thread until all runnables have started
executing. Otherwise, what the cancel() loop below actually
does will vary from run to run.
Change-Id: Ib912b0943e7bbd55c9480ae6fd4011ba20ac457e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead of allocating a statically-sized array on the heap,
use an automatic C array instead.
Replace some magic numbers with named constants.
Change-Id: I17d29a76a67c4a413453ac26a5dee8cd54a8a37d
Reviewed-by: David Faure <david.faure@kdab.com>
Manipulating a simple int from multiple threads is a data race,
thus undefined behavior.
Fix by using QAtomicInt and atomic operations instead.
Change-Id: I5418bc260da57fe353a71b8e5c7c1c97adbe7597
Reviewed-by: David Faure <david.faure@kdab.com>
This should reduce the failure rate. We're still doing qSleep of the
same amount of time, but we now only fail if the slip is over 100 ms.
Task-number: QTBUG-58713
Change-Id: I536c32a88bff44dab37afffd14a1afdf0b2e522a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The runUpdateMimeDatabase() call was timing out on the CI due to
running out of the default 30s timeout for QProcess::waitForFinished()
(on my machine, that call takes less than 0.5s, reliably...).
Increase to two minutes.
Change-Id: I61b2e060ea9c2508b853847ba7040ad499e0084c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
When one of the QCOMPAREs in Consumer::run() fails, the consumer
returns early, leaving the producer deadlocked in a QSemaphore's
acquire() call. Change these to tryAcquire() with a large timeout,
so the producer, too, eventually leaves run().
Change-Id: I7421d43305decd4754e09c8e092363594d1be06b
Reviewed-by: David Faure <david.faure@kdab.com>
This test was determined to be flaky on the CI.
Task-number: QTBUG-58741
Change-Id: I43196d3a27f726fb96b427f5071e726b571a0404
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Add proper support for 'so' and 'bundle' suffixes. Qt wrongly assumes
.so libraries are not versioned on Apple platforms, which is
wrong. Also, the shared library .bundle which is what Apple recommends
instead of .so, are also versioned (not to be confound with the
different Core Foundation bundles, which are directory hierarchy).
For more info, see http://docstore.mik.ua/orelly/unix3/mac/ch05_03.htm.
Especially the part that reads:
"Loadable modules, called bundles in Mac OS X, have the file type
MH_BUNDLE. Most Unix-based software ports usually produce bundles with a
.so extension, for the sake of consistency across platforms. Although
Apple recommends giving bundles a .bundle extension, it isn't
mandatory."
Task-number: QTBUG-50446
Change-Id: Iacd5136397a12d65d83821434f332eb602550b4b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This reverts commit b0c1e07d64.
The unit tests it introduced trigger errors with the macOS and
Win32 implementations, which means the there's something seriously
wrong with either the API, our implementation or the tests.
Revert for now until this gets fixed. Blacklisting was also the
wrong tool to use. The tests should have used QEXPECT_FAIL.
Change-Id: Ida20c6bbe0c019835a22464535029585e8e1e367
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
There weren't any, at all.
Testing on the CI showed that the implementation is broken on
macOS, and, to a lesser extent, on Windows, so blacklist the
failing tests until the implementation can be fixed. No need
to hold back testing the other implementations.
Task-number: QTBUG-58737
Change-Id: I9ae16ab778dbe2e95a6ca5e0bae00df4bad65cb2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Since 5.7, QIODevice::peek() implementation is based on transaction
mechanism. While technically it's correct, seeking backward on a
buffered random-access device clears the internal buffer that affects
the performance of reading.
To solve the problem, this patch implements peek mode directly inside
the reading procedure.
Task-number: QTBUG-56032
Change-Id: Ic5269f76e44c491a0309e13aba87fa7cf7b9259f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This test was determined to be flaky on the CI.
Task-number: QTBUG-58713
Change-Id: Ie6e6a69b8ea625e3a3102c88d52f1f0fbec242aa
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
I didn't even try to understand what the old code was trying to do;
once you're told by a user that the code is wrong, you see that it is.
Fixed by just using the row as passed to takeRow() instead of trying
to do some storage-index calculations. The m_matrix indexing operator
does it all for us.
Added a test that checks that the expected field widget gets
returned. Fixed expected test data that was wrong, and just checking
that the implementation behaves as implemented, instead of as
documented.
Amends change 8fbae648db.
[ChangeLog][QtWidget][QFormLayout] The functions takeRow() and
removeRow(), new in 5.8.0, now take and remove the correct row.
Task-number: QTBUG-58693
Task-number: QTBUG-15990
Change-Id: I7185ccbc6c03e2579741cad5c0c821d3ed165474
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
When a non-QString-backed mode (via the (QChar*, int) ctor) was added
for Qt 4.5, the author forgot to adjust the setCaseSensitivity()
function. It still uses q_pattern instead of (p.uc, p.len) as the
pattern for which to create the skip-table. Since there is no
setPattern() overload for this mode, the correctness of the matcher is
not harmed by this, but its performance degrades to that of a linear
scan: the skip-table, being filled from an empty pattern, will be
all-zeros, sending bm_find() into the 'possible match' case at every
character.
Since matching is still correct, but slow, it's not possible to write
a test for this. I did, however, leave my attempts in the auto-test,
for when we add QStringView overloads of setPattern() which will then
be able to expose the bug.
Change-Id: I7b803e8624b0352a0a974900affbbfc0c260d93b
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The setData method of an item view would get an incorrect value of a
QDialog's result. This patch changes the order of functions called to
fix that.
[ChangeLog][QtWidgets][QDialog] Fixed a bug where accessing the result
of QDialog's result could yield an incorrect value in some situation
like using it as a delegate for item views.
Task-number: QTBUG-6018
Task-number: QTBUG-12156
Task-number: QTBUG-14430
Change-Id: I6ee4b6e8cacf6a806631c05c6c5dbcff925df65e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
As explained in
https://blogs.kde.org/2009/03/26/how-crash-almost-every-qtkde-application-and-how-fix-it-0
creating dialogs on the stack is a bad idea if the
application or the dialog's parent window can be closed
by means other than user interaction (such as a timer or
an IPC call). Since we cannot know whether Qt is used to
build such an application, we must assume it is, create
the dialog on the heap, and monitor its lifetime with a
QPointer.
Instead of using manual resource management, add a
minimal implementation of QAutoPointer, and use that in
all static get*() functions.
Task-number: QTBUG-54693
Change-Id: I6157dca18608e02be1ea2c2defbc31641defc9d1
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: David Faure <david.faure@kdab.com>
When a QFile object is reused, the atEnd() method may return incorrect
values. The reason for this is that QFileDevicePrivate::cachedSize is
not cleared. Setting cachedSize = 0 in the close() method fixes this issue.
Task-number: QTBUG-57698
Change-Id: I828a2cf844e98d581098f2c781fa47d2cd3275ce
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
At 200 ms, the error on first firing could be 10 ms.
Task-number: QTBUG-58519
Change-Id: Ifaee7464122d402991b6fffd14a02a4ce782f11f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
On macOS, the code that read the plist is using
QByteArray::fromRawCFData. When we return the data directly
we need to detach the QByteArray so that it does not point
CFData's data that will get deallocated just after the call.
Task-number: QTBUG-58531
Change-Id: If829a304b986c99c8fc2aeeb992f2d539a4eef3a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
As used in recent qtdeclarative commits, so better make sure it keeps working.
Change-Id: I6d0ceda76201e3e7f75661cb6449e1ff32329126
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>