Commit Graph

3513 Commits

Author SHA1 Message Date
Lars Knoll
bab398aba3 Fix memory leak in auto test
Change-Id: Ie4412b8d8c67e9516225f6fe5b67afed91dcdad5
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2019-03-29 13:46:56 +00:00
Lars Knoll
a9cd08c3f3 Fix memory leak in auto test
Change-Id: I2e8d8cc0f248122b06c7c8313d8effac887adaa8
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2019-03-29 13:46:51 +00:00
Lars Knoll
6e0b5dadc7 Change cleanup mechanism for orphaned connections
Put all connections that get disconnected into a singly
linked orphaned list.

Whenever the refcount on the connectionData drops down to
one, this list can safely be cleared, even with the planned
removal of locking in activate().

Use an id integer in the connection to acoid activating newly
added connections.

Fixes: QTBUG-72649
Change-Id: Ide3d116ae7fc9ca497598c1c2b71d43b4339c92d
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2019-03-29 13:46:17 +00:00
Edward Welbourne
79f17db879 Suppress warnings about deprecated methods in their tests
Fixed the other tests that used the methods, so that they now get the
data from QLocale instead; and added the missing feature #if-ery, as
these are textdate methods.

Change-Id: I896f356bdf88037db23590c71d0aeb0b8722bfa7
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2019-03-27 13:43:47 +00:00
Edward Welbourne
7d74404325 Replace a misguided test with a valid one
The code had min and max of an integral type and tested min + min / 2,
which naturally overflowed, provoking a compiler warning.  The test
was meant to be testing min - min / 2; but min is even, so this is
just min / 2; and doubling that won't overflow (which is what the test
is about).  As it happens, min + min / 2 is in fact max - max / 2,
which *would* be a good value to test, since max is odd.  So add a
test for that and remove the broken test.

Change-Id: Iec34acbf0d5d7993d41ff844875dc10480b8eb1f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-03-27 13:43:21 +00:00
Allan Sandfeld Jensen
66e1473096 Use move more consistently in QScopedValueRollback
Use move on the existing value as well so the constructor makes more
of a difference.

Change-Id: Iee2080da7b7d2d88eb108f0448c61423c7256979
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-03-27 07:56:15 +00:00
Friedemann Kleint
7f635d9777 Merge remote-tracking branch 'origin/5.13' into dev
Change-Id: I38389a69411f4549fed432f1181dbe23398b34a2
2019-03-26 08:24:59 +01:00
Mikhail Svetkin
4054759aec core: Add deduction guides for QPair
[ChangeLog][QtCore] Added support of deduction guides for QPair

Change-Id: I41a798390dc2c925b0f8432ba12aa345724de2d7
Reviewed-by: Martin Smith <martin.smith@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2019-03-25 19:48:29 +00:00
Allan Sandfeld Jensen
461e89ee1a Clean up QTextStream functions
They are the only Qt symbols neither prefixed with q or with the Qt
namespace. This changes preserves source and binary compatibility
while making it possible to define conflicting symbols.

Change-Id: I6d4181206e63faa922fa0c8b644e0a4b88826a97
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-03-23 10:00:18 +00:00
Milian Wolff
1e70781e7f Stabilize tst_QStateMachine::dontProcessSlotsWhenMachineIsNotRunning
The test is flaky which was uncovered by the upcoming
QTimer::singleShot optimization patches:

When the Emitter's thread is started and executes the timout functor
before the state machine is started, then the state machine will never
see the emitSignalWithNoArg signal and thus never transition to the
final state and finish.

This patch ensures that the code in the background thread is only run
after the state machine was started to fix this flakyness.

Change-Id: I6f91a2420165662ece75e550a6d73fe098137d4c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
2019-03-22 19:24:19 +00:00
Kari Oikarinen
3c4721488a QVector: Add assignment from std::initializer_list
Change-Id: I88a66e4b78ca6f40c328070f275e7163fb0d691c
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2019-03-21 15:53:52 +00:00
Timo Lang
758151d077 QVariant: Fix isNull() == true after downcasting QObject*
[ChangeLog][QtCore][QVariant] Fixed a bug that caused isNull() to be
true after downcasting a QObject* payload using convert().

Fixes: QTBUG-73196
Change-Id: Ifda15952f873d7142c95609b69ac424bbf16b723
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2019-03-21 21:42:34 +00:00
Qt Forward Merge Bot
6893919b0c Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
	src/gui/kernel/qplatformintegration.cpp
	src/gui/kernel/qplatformintegration.h
	src/plugins/platforms/wasm/qwasmintegration.cpp
	src/plugins/platforms/xcb/qxcbconnection_screens.cpp

Change-Id: I15063d42e9a1e226d9d2d2d372f75141b84c5c1b
2019-03-20 14:09:30 +01:00
Edward Welbourne
3c4e202fe4 Make tst_QTemporaryFile::fileTemplate() more informative on failure
A QCOMPARE(..., true) isn't much use; and failure would have set the
object's .errorString(), which seems like it'd be worth reporting, so
use QVERIFY2() instead.

Change-Id: I2f3f9379984694891de81d2ffebc696d91eec70f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-03-19 17:52:39 +00:00
Edward Welbourne
84aea6c091 Add qFpClassify() to mirror std::fpclassify()
The rules of std don't permit us to add an overload for
fpclassify(qfloat16), so we need our own equivalent that we *can*
overload.  Deploy it in the few places we use fpclassify().

Extended qnumeric's testing to cover qFpClassify().

Change-Id: Ie5a0a5cc24599d1571404c573d33c682b0d305a5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-03-19 17:52:30 +00:00
Edward Welbourne
368eb2ecec Refine and extend tst_qnumeric's checks on infinity and NaN
Renamed the test, since it covers both, verified slightly more and
added checks that QCOMPARE() copes as intended.  Fixed some minor
coding-style defects in the process.

Change-Id: I49c2ffa0568a29e9e4b7f7395d4cacdeb0401da0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-03-19 17:52:20 +00:00
Qt Forward Merge Bot
11b9c813e6 Merge remote-tracking branch 'origin/5.13' into dev
Change-Id: Ief0a0b754c104d5348fee9ee15e967bd37c526f8
2019-03-16 01:01:30 +01:00
Qt Forward Merge Bot
a1808c5dbe Merge remote-tracking branch 'origin/5.12.2' into 5.12
Change-Id: I5f9d8090a07056411fb65d7de60eb679d00e99a3
2019-03-15 11:10:10 +01:00
Qt Forward Merge Bot
e608b5d555 Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I2bf3b4ceb79364330eae4cbf3cdee9a82d1be46d
2019-03-15 01:00:43 +01:00
Kai Koehne
097bf6fdd2 Fix compilation of qCDebug("", ...) with QT_NO_DEBUG_OUTPUT
... and fix QT_NO_INFO_OUTPUT, QT_NO_WARNING_OUTPUT alongside.

Fixes: QTBUG-74359
Change-Id: I2167dc943ae8c52602e08e24ca815d95f82a5db8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-03-14 17:15:53 +00:00
Anton Kudryavtsev
b35eec360d QStringMatcher: add QStringView support
While touching the code, deduplicate some methods.

Change-Id: I28f469f0e9ae000a34466b0ecc604b5f3bd09e63
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-03-14 04:48:06 +00:00
Volker Hilsheimer
75c6bd54d7 Avoid copying QByteArray created via fromRawData in toDouble
qt_asciiToDouble accepts a length parameter, so we can just pass
that through. No need for explicitly null-terminating, which is
where the copy of the data would be made.

Change-Id: I4e7921541f03295a2fae6171b35157084ff3ed8c
Fixes: QTBUG-65748
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-03-09 15:26:24 +00:00
Qt Forward Merge Bot
261c0dedac Merge remote-tracking branch 'origin/5.13' into dev
Change-Id: I056b658ffe9390dfcbe2787e2bddc7f4e9b389dd
2019-03-09 01:00:55 +01:00
Liang Qi
2add2dbdaa Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
	src/network/access/http2/hpacktable_p.h

Change-Id: Ie0c296667dfdebba84f4858056a1ac80c24ee7df
2019-03-06 12:31:50 +01:00
Edward Welbourne
c9ff943f8f Restructure tst_QDir::mkdirRmdir_data()
Iterate over a struct array rather than having a list of strings to
pull things out of, by individual index; this makes it easy to include
the non-existence check for directories in the same loop. In the
process, give the absolute-path tests a prefix to mirror the relative-
prefix on their partners. This prepares the way for adding more
test-cases.

Change-Id: Id839caedf92387dfa9b94f31253410285f72ff70
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-03-05 18:23:23 +00:00
Edward Welbourne
1b5dbebb93 Deprecation-fix: don't use QDir::operator=(const QString &)
Use setPath() instead, as advised in the deprecation warning.

Change-Id: I2f22220885938808c8efb85720ad10f7e05801ff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-03-05 12:31:23 +00:00
Christian Ehrlicher
332f295743 QtBase: replace deprecated QString functions
Replace deprecated QString functions in examples and tests:
 - QString::sprintf()
 - QString::null
 - QString::fromAscii

Change-Id: I4404d17c1a65496c9079e8a7300e72a5b3740fe5
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2019-03-04 16:54:12 +00:00
Alex Richardson
47bb74fd15 Fix build with -no-gui on macOS
Some directories that depend on QtGui were being included without the
appropriate check for qtHaveModule(gui).

Change-Id: I7c348c74464d44cbd35a027f188f8a23bb2021d9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-03-04 12:25:53 +00:00
Qt Forward Merge Bot
7aa204d5b3 Merge remote-tracking branch 'origin/5.13' into dev
Change-Id: Icec0aa703d8a13efa9f1634a1a353eb9d63685c8
2019-03-01 01:00:54 +01:00
Edward Welbourne
d8cf721d60 Update the DNS public suffix list from publicsuffix.org
Regular update in preparation for 5.13, adding tests for additions
since 5.9.4/5.10.1/5.11.0's update 7e946030 (the last to record its
upstream version sha1).  Corrected the license header: it's now
published under MPL 2.0 (not 1.1); and our secondary licensing of it
is as LGPL3.  Deferred full header over-haul until we've worked one
out in detail.

[ChangeLog][Third-Party Code] Updated DNS public suffix list

Task-number: QTBUG-72623
Change-Id: Iabdbbbfd79624830396c2a6fe0a73389bd6ce5b7
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2019-02-27 12:49:30 +00:00
Juha Karjalainen
0f163887b5 Fix blacklisting tst_QTimer::basic_chrono()
Blacklisting did not work as blacklist should have contained osx
instead macos

Change-Id: Ifd76a38d371ccce545eb5df030aaa819b00a5b48
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2019-02-21 05:18:00 +00:00
Qt Forward Merge Bot
035f934d7a Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
	tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp

Added tests/auto/testlib/selftests/expected_crashes_5.txt to work
round the output of the crashes test (which exercises UB, see
QTBUG-73903) being truncated on one test platform.

Change-Id: I9cd3f2639b4e50c3c4513e14629a40bdca8f8273
2019-02-20 09:51:12 +01:00
Qt Forward Merge Bot
67c70b22f6 Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: Ifa143cc462301aaa305c9c85360e543553a751f0
2019-02-19 01:00:08 +01:00
Joerg Bornemann
8fe3680193 Add cmdline feature to qmake
[ChangeLog][qmake] A new feature "cmdline" was added that implies
"CONFIG += console" and "CONFIG -= app_bundle".

Task-number: QTBUG-27079
Change-Id: I6e52b07c9341c904bb1424fc717057432f9360e1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2019-02-18 07:12:14 +00:00
Qt Forward Merge Bot
d3b3be6865 Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: Iad53d4f21263718b8ecf15fd2d1170d24c7b675d
2019-02-12 13:53:22 +01:00
Olivier Goffart
484eec96f9 Add a couple of tests in QObject::tst_qobject
For destructors of functor connected to signals

Change-Id: I3f8b18fee7507f3cb72e36a2f9e6ef7f37dbeea1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-02-08 21:55:47 +00:00
Edward Welbourne
c066656aff Avoid read-outside-array error by QStringRef over-reach
Constructing a QStringRef directly from the string, offset and a
length is UB if the offset + length exceeds the string's length.
Thanks to Robert Loehning and libFuzzer for finding this.
QString::midRef (as correctly used in both changed uses of QStringRef,
since 432d3b6962) takes care of that for us.  Changed one UB case and
a matching but correct case, for consistency.

In the process, deduplicate a QStringList look-up.
Added tests to exercise the code (but the one that exercises the
formerly UB case doesn't crash before the fix, so isn't very useful;
the invalid read is only outside the array it's scanning, not outside
allocated memory).

Change-Id: I7051bbbc0267dd7ec0a8f75eee2034d0b7eb75a2
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-02-08 13:56:25 +00:00
Liang Qi
fbfacd33be Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
	src/android/templates/AndroidManifest.xml
	src/network/ssl/qsslsocket_mac.cpp
	src/widgets/styles/qstylesheetstyle.cpp
	tests/auto/corelib/kernel/qtimer/BLACKLIST
	tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp
	tests/auto/testlib/selftests/expected_blacklisted.lightxml
	tests/auto/testlib/selftests/expected_blacklisted.tap
	tests/auto/testlib/selftests/expected_blacklisted.teamcity
	tests/auto/testlib/selftests/expected_blacklisted.txt
	tests/auto/testlib/selftests/expected_blacklisted.xml
	tests/auto/testlib/selftests/expected_blacklisted.xunitxml
	tests/auto/testlib/selftests/expected_float.tap
	tests/auto/testlib/selftests/expected_float.teamcity
	tests/auto/testlib/selftests/expected_float.txt
	tests/auto/testlib/selftests/expected_float.xunitxml

Done-With: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Done-With: Edward Welbourne <edward.welbourne@qt.io>
Done-With: Timur Pocheptsov <timur.pocheptsov@qt.io>
Change-Id: If93cc432a56ae3ac1b6533d0028e4dc497415a52
2019-02-08 12:31:02 +01:00
Tony Sarajärvi
5d885c8325 Blacklist qtimer/basic_chrono on macos due to flakiness
Task-number: QTBUG-73168
Change-Id: I56b45b7f474bdad73f6cd8514b42475e6107b6be
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2019-01-30 10:10:19 +00:00
Tony Sarajärvi
49ca66583a Expand blacklisting of qthreadpool to cover linux distros
Task-number: QTBUG-38594
Change-Id: I07dccf8ac6ab07e61ddf6090037ea344449724f8
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
2019-01-30 10:10:17 +00:00
Liang Qi
e3621dd6bd Merge "Merge remote-tracking branch 'origin/5.12' into dev" into refs/staging/dev 2019-01-28 19:30:32 +00:00
Kai Koehne
112278d3d7 Avoid test failures in tst_qtimezone.cpp and Windows 10 1809
The test started to fail now also for latest Windows 10 Update
Restone 2. It's unclear why the test was succeeding before, since this
seems a generic Windows API issue.

Task-number: QTBUG-64985
Task-number: QTQAINFRA-2255
Change-Id: I804f6a61c63ea70157353d1aee9027d0735073ab
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-01-28 15:02:52 +00:00
Christian Andersen
6a7e2fedef Windows: improve QTimer::remainingTime when called before processEvents
This checks that intenalHwnd in QEventDispatcherWin32::remainingTime is
initialized. If calling remaningTime, before createInternalHwnd
is called, the timeout member in the WinTimerInfo struct is not
initialized and contains a random value. This adds a check for that and
in that case returns the requested timer interval as the timer has not
yet been started. createInternalHwnd is called on the first request to
process events.

It also adds a test for checking the remaining time. But the issue can
only be seen if solely running the remainingTimeInitial test in
tst_QTimer. If running the test along side another test the other
test likely calls processEvents indirectly, which hides the issue. I
don't know if this is an issue in practice (the bug has been there
for as long a the git history goes back, 2011), but it causes the
basic_chrono test to fail if run as the only test.

Change-Id: I05c35105da778912dedf8d749aa7c953841d986e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-01-28 06:34:03 +00:00
Christian Andersen
e85f43fd4d tst_QTimer: relax time requirement on remaining time
Before this the remaining time in the two tests 'remainingTime' and
'basic_chrono' had to be within the interval [100,200]. This relaxes
that to [50,200]. This test seems to be failing a lot when staging
changes in gerrit. I can reproduce some of the problem when putting a
lot of load on my system and running the tests, then remaining time is
very random.

Also removes the blacklist of remaingTime on Windows and macOS, as
basic_chrono and remaningTime tests are basically the same. The
tests also fails on Linux some times in gerrit.

I was also thinking one could:

- blacklist both tests
- remove interval requirements; just check remaining time is [0,200]
- remove the tests

Task-number: QTBUG-61013
Change-Id: I5c8f0754d059598e023fe8e5d511f4a50bb4bac2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-01-27 17:53:31 +00:00
Liang Qi
980567b3a3 Merge remote-tracking branch 'origin/5.12' into dev
Conflicts:
	src/android/templates/AndroidManifest.xml
	tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp

Change-Id: I4c9679e3a8ebba118fbf4772301ff8fde60455b9
2019-01-26 08:35:40 +01:00
Christian Ehrlicher
7c69f6171d QFile/QFileInfo: mark readLink() as deprecated
QFile/QFileInfo::readLink() functions are obsolete but were not marked
as deprecated.
Explicit mark them as deprecated so they can be removed with Qt6.

Change-Id: I52424dc5441e1f5b01015713df990bbec5186caa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2019-01-23 18:49:15 +00:00
Christian Ehrlicher
5eab68bbee QProcess: mark obsolete functions as deprecated
QProcess::finished(int)/readChannelMode()/setReadChannelMode() are
obsolete but were not marked as deprecated.
Explicit mark them as deprecated so they can be removed with Qt6.

Change-Id: Iedbfd80a3c987f35caf93181e9277913a18961d9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-01-23 18:49:12 +00:00
Tor Arne Vestbø
237c3972fd Allow more fine grained control over QFlags debug output
Useful in contexts such as other QDebug operators, where the class
is already known, and the full scope of the flags is not needed.

Change-Id: I546381b1722c9c846e2412e56763563b8f625212
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-01-23 16:12:52 +00:00
Tor Arne Vestbø
25fc90e48b Allow more fine grained control over QMetaEnum debug output
Useful in contexts such as other QDebug operators, where the class
is already known, and the full scope of the enum is not needed.

Change-Id: Ibd04b1fd4f0f914c7224a007fc248d4ebabcde3e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-01-23 16:12:50 +00:00
Qt Forward Merge Bot
e3da05f39a Merge remote-tracking branch 'origin/5.12.1' into 5.12
Change-Id: Icebd151eae0cf9d400319a42573290d1a911ce26
2019-01-23 10:13:29 +01:00