Commit Graph

40833 Commits

Author SHA1 Message Date
Timur Pocheptsov
0ce3f7d62b QMacStyle: workaround NSSliderCell's cached/stale geometry
It's a bit cheesy solution, but works as I've noticed first on
QSlider's with a ticks direction 'both'. Works because we were
already using numberOfTickMarks property to trigger a special
behavior for HIG non-compliant widgets. Works for our case too
- we trigger a geometry update.

Fixes: QTBUG-76811
Change-Id: I2cbf00d42d98e78519b281d138a2f74227ef5449
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-25 10:15:41 +02:00
Michael Brasser
65cdd0f366 Enable shader cache for ES2 when GL_OES_get_program_binary is present
Change-Id: I4fb71471a7dd22441def1eb837857d245c3e3c5a
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2019-07-25 01:49:48 -05:00
Marc Mutz
c13bb2a66a QObject: replace QScopedPointer with std::unique_ptr in the implementation
Use the standard tool instead of self-made stuff that cannot decide whether
it wants to be a scoped pointer (why take()?) or a movable one (why no move
special member functions?).

Take advantage of C++11 local structs for pulling the custom deleter into
the scope where its only user is located, too.

Change-Id: I7e097a59edef9adc8455504ae94b8df0f8b9e5d2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-07-24 18:06:30 +02:00
Marc Mutz
fd42589b14 Extend QString::arg(QString, ..., QString) to more than 9 arguments
Now that we have QStringView::arg(), we can use it to implement a
similarly flexible QString::arg(). It's not as straight-forward as in
QStringView, though: QString has existing arg() overloads that all
become worse matches with the introduction of the new,
perfectly-forwarding overload.

So in order to allow calling of the other arg() functions, first
constrain the new arg() function to arguments that are convertible to
QString, QStringView, or QLatin1String, and then delegate to the
QStringView version. To stay compatible with the previous overloads,
which accepted anything that implicitly converts to QString (in
particular, QStringBuilder expressions), add a new overload of
qStringLikeToView, taking const QString &. This benefits the existing
QStringView and QLatin1View versions, too.

[ChangeLog][QtCore][QString] QString::arg(QString, ..., QString) can
now be called with more than nine arguments, as well as with
QStringViews.

Change-Id: I1e717a1bc696346808bcae45dc47762a492c8714
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-24 17:31:25 +02:00
Timur Pocheptsov
e4c1feae5c Implement 'preconnect-https' and 'preconnect-http' for H2
QNetworkAccessManager::connectToHostEncrypted()/connectToHost()
creates 'fake' requests with pseudo-schemes 'preconnect-https'/
'preconnect-http'. QHttp2ProtocolHandler should handle this
requests in a special way - reporting them immediately as
finished (so that QNAM emits finished as it does in case of
HTTP/1.1) and not trying to send anything.
We also have to properly cache the connection - 'https' or
'http' scheme is too generic - it allows (unfortunately)
mixing H2/HTTP/1.1 in a single connection in case an attribute
was missing on a request, which is wrong.
h2c is more complicated, since it needs a real request
to negotiate the protocol switch to H2, with the current
QNetworkHttpConnection(Channel)'s design it's not possible
without large changes (aka regressions and new bugs introduced).

Auto-test extended.

Fixes: QTBUG-77082
Change-Id: I03467673a620c89784c2d36521020dc9d08aced7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-07-24 16:03:02 +02:00
Oliver Wolff
589d96b9b0 winrt: Remove QWinrtScreen::pixelDensity so that the default of 1.0 is used
Winrt does device independent scaling by default so that overwriting
pixelDensity for QWinrtScreen will break the use case of setting
Qt::AA_EnableHighDpiScaling. That mode is basically always active on
winrt.

Task-number: QTBUG-76363
Change-Id: Ib522201850d17757be4a80aa819c3f1245ca7147
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
2019-07-24 08:49:09 +02:00
Marc Mutz
ca5fc087bd Re-apply 'Skip old benchmark that doesn't build automatically'
This commit re-applies commit f8efe8e0c9,
which was lost in the recent tools → text changes.

Change-Id: I03ce35fcb89840e5607776d67578fb75b66f6eb2
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-07-24 07:45:59 +03:00
Tasuku Suzuki
3bbbc8510a Fix typo in configure script
Change-Id: Icc979dd58e061c62d45305e00580d27d0cd4af69
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-07-24 10:42:16 +09:00
Allan Sandfeld Jensen
83de6d0ce5 Add support for saving colorspace to PNGs
Also fixes interaction with QImageReader gamma correction

Change-Id: I108f253697f7ff60be6940bca17faa9f9ceb577b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2019-07-23 23:37:45 +02:00
Allan Sandfeld Jensen
733ca2230c Fix comparisons of image with different color spaces
Take color space into account when comparing images, and fix gamma
comparison that was trying to be too accurate.

Change-Id: I3674653abb21b66aaacb557addc4afb4ee75cfdd
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2019-07-23 23:37:37 +02:00
Sona Kurazyan
b6f7efba48 Make sql tests build and pass with disabled deprecated APIs
Deprecated APIs of sql lib are used only in tests. This change
makes sure, that the tests build and pass with those deprecated APIs
removed or disabled, by:

- Making the parts of the tests testing the deprecated APIs to be
  compiled conditionally, only when the corresponding methods are
  enabled.

- If the test-case tests only the deprecated API, but not the
  corresponding replacement, added tests for the replacement.

Task-number: QTBUG-76541
Change-Id: I93ed6ff92c7aa7af2c106b1a9d92d3704c7d9105
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2019-07-23 20:48:44 +02:00
Sona Kurazyan
9c2f18d357 Remove usages of deprecated QApplication::keypadNavigationEnabled
Added QApplicationPrivate::keypadNavigationEnabled() as a
replacement of deprecated QApplication::keypadNavigationEnabled(),
for the internal usage.

Task-number: QTBUG-76491
Change-Id: I75f4c628b72d86b5e428e7e285a786d23abbf3f2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-23 20:48:33 +02:00
Sona Kurazyan
19f72c17c0 Make network tests build and pass with disabled deprecated APIs
Deprecated APIs of network lib are used only in tests. This change
makes sure, that the tests build and pass with those deprecated APIs
removed or disabled, by:

- Making the parts of the tests testing the deprecated APIs to be
  compiled conditionally, only when the corresponding methods are
  enabled.

- If the test-case tests only the deprecated API, but not the
  corresponding replacement, added tests for the replacement.

Task-number: QTBUG-76541
Change-Id: I78c4913155007fd1d0df2c38e1b9a8b80066adeb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-07-23 18:48:17 +00:00
Allan Sandfeld Jensen
181e96cae2 Remove public d_func from QColorSpace
Replaced with getter in private.

Change-Id: I968eb45052a80b45750213cf6a0c08b5973dfc4d
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2019-07-23 19:07:56 +02:00
Shawn Rutledge
aa4470943d Procrastinate QWheelEvent deprecations until 5.15
It turns out that Qt3D has uses of x() and y() in a header, which is
an error rather than just a warning.  So we need more time to do
a qt5.git submodule update, then fix Qt3D. Amends
7d29807296

Change-Id: Ibead628e7094316bb17d5924f6c6f75dbda5826b
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-07-23 14:43:35 +00:00
Allan Sandfeld Jensen
c21cc647e9 Fix lancebench results oddness
Imports were expanded in the list of commands every time they were
evaluated. This meant any test with imports ran slower and slower the
more iterations it got through.

Fixed by creating a new PaintCommands object every time and living with
initialization of it being part of the benchmark results.

Change-Id: Ib53a3a25f1393437452bc5aede04ccb63e8715a6
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2019-07-23 11:47:51 +00:00
Lorn Potter
547f216efd wasm: fix international dead keys
Emscripten has changed the key code to include the string 'Digit'
on numerals. We use this to detect and translate any Dead keys that
may be pressed.

Fixes: QTBUG-77041
Change-Id: I054e98a6cf66390b1154f25fe385e5b12840851f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-23 17:40:10 +10:00
Shawn Rutledge
86f91bf0f7 Make the warning in QBackingStore::endPaint() a little more helpful
Amends 2aa9908e24

Change-Id: I2883ca27b06b2b414b4991b2dab3f84100b4c853
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-07-22 13:09:37 +02:00
Liang Qi
46cb35fccc Merge "Merge remote-tracking branch 'origin/5.13' into dev" 2019-07-22 12:34:37 +02:00
Laszlo Agocs
f4e0dda205 rhi: gl: Fix feature version check logic
It was somewhat incorrect in a few places.

Some of these should be moved to QOpenGLFunctions/Extensions later.

Change-Id: Ibc7a6409f16ddf1ad71230671dcad558dac1b86f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-07-22 07:12:43 +02:00
Liang Qi
261a87f956 Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
	qmake/generators/makefile.cpp

Change-Id: Ib3715e626f2fd32804c75c16ea9aa06a1216e76d
2019-07-22 06:50:42 +02:00
Mike Krus
b202d45026 Make simulator detection work with Xcode 11
Beta version of Xcode 11 changes the format of the json object
returned by simctl and used to detect running simulators.

While multiple versions of Xcode can coexist on the same system,
they share the same simulator infrastructure so installing
Xcode 11 Beta affects projects using previous versions.

Change-Id: Icf06a794aa5ba3624163ace2ce827c0ecf97c38c
Reviewed-by: Frank Osterfeld <frank.osterfeld@kdab.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-07-21 14:05:15 +01:00
Mat Sutcliffe
0652bdcf5e QJsonObject: add QLatin1String overloads of non-const methods
Also optimized the existing QL1S overload of non-const operator[](), and
applied Extract Method refactoring to the other existing QL1S overloads.

[ChangeLog][QtCore][QJsonObject] Added insert(), remove(), and take()
overloads taking QLatin1String.

Change-Id: I5e737cf2d7d9ffb325d6981db1e4a6a9f093657b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
2019-07-20 12:04:48 +01:00
Mat Sutcliffe
7f8e3aab2d JSON: add some QStringView overloads
[ChangeLog][QtCore][JSON] Added overloads of functions taking key
strings as QStringView; in QJsonObject, QJsonValue and QJsonDocument.

Change-Id: I78b40aba8200003acfae257ff06f5f15737005e7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
2019-07-20 12:04:31 +01:00
Mat Sutcliffe
a4e9fa03ca QJsonObject: minor refactoring
Applied DRY principle.

Change-Id: Ic3035552c6174167b4fe19fd4c825500dff16ded
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-07-20 12:04:14 +01:00
Mat Sutcliffe
8010e906d3 Optimize non-const overload of QJsonObject::operator[]
Refactored parts of insert() into a new private method insertAt(), which
can also be called by operator[]() to avoid a redundant key lookup.

This is in preparation for overloading QJsonObject's non-const methods
on QLatin1String.

As a bonus, this also avoids a redundant key lookup in
QJsonValueRef::operator=().

Change-Id: Ic481981d838e50bc55fb8e7844536749781899ce
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-07-20 12:03:32 +01:00
Tor Arne Vestbø
857e4881c6 macOS: Properly unpolish font and palette
Explicitly setting the application font and palette will actually
persist the current state of the application font and palette to
the widget, and it will stop reacting to system style changes.

Change-Id: Ib856fe86cd3edb618b7ee5819d6c6c892c61fd1d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-07-20 12:03:29 +02:00
Qt Forward Merge Bot
5f1cf8e0f5 Merge "Merge remote-tracking branch 'origin/5.12' into 5.13" 2019-07-20 01:00:26 +02:00
Qt Forward Merge Bot
124b5b8108 Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: Ic34021fbb87d689ee23a5d1b3f50617ada9ec9b9
2019-07-20 01:00:13 +02:00
Marc Mutz
ce86c3373e QHostInfo: un-QObject-ify QHostInfoLookupManager
QObjects are not even reentrant, but this class must be thread-safe,
so it's always ... icky ... to have to analyze a "thread-safe
QObject", because for all intents and purposes, that's an oxymoron.

The QObject-ness isn't even used, except for defining a private slot,
connected to QCoreApplication::destroyed(). That slot just calls
waitForDone() on QThreadPool, which is a QObject itself, so use it
as the context object for the signal-slot connection, using a lambda
as slot.

So, strip the class of it's base class, convert the private slot to a
lambda and connect to that. Finally, remove the moveToThread() call,
because this new class can be destroyed from any thread, not just the
main one.

Change-Id: I0e33983aa7afd0ad621ece4afd10d9e4adad38c1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-19 22:16:04 +02:00
Yulong Bai
a96a64be2d qmake: fix variable naming conflicts with C++20 keyword
It conflicts with 'requires' keyword.

Fixes: QTBUG-77093
Change-Id: I85e8f530dd1e2bf9a31906dd6c5123b947235b01
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-07-19 21:31:50 +02:00
Thiago Macieira
65f9646583 Fix QCborStreamReader not flushing QIODevices due to internal buffering
When successfully finishing a parse, it's reasonable to expect that the
QIODevice was advanced to the end of the input data.

[ChangeLog][QtCore][QCborStreamReader] Fixed a bug that caused the
QIODevice that the data was being read from not to show the entire CBOR
message as consumed. This allows the user to consume data that may
follow the CBOR payload.

Fixes: QTBUG-77076
Change-Id: I1024ee42da0c4323953afffd15b23f5d8fcc6f50
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2019-07-19 12:31:42 -07:00
Marc Mutz
315ac36e5d QFile: hold engine by unique_ptr
Unfortunately, we can't, yet, change QAbstractFileEngine::create() to
return a unique_ptr. But we should do it in Qt 6.

Change-Id: If18ff766bce73ecd4143274ac9f9a5a7b9d5912c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-07-19 17:08:45 +02:00
Marc Mutz
2851f6eae9 QHostInfo: remove unused QAbstractHostInfoLookupManager
If it was used in the past, it no longer is, and can't be, because
it's not exported.

Change-Id: Ifb9c353e756add5b57bf0c5706c075bb2eb41d83
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-07-19 16:44:38 +02:00
Marc Mutz
cab920d52c QSharedNetworkSessionManager: prune expired QNetworkSessions
Equality for QNetworkConfiguration is defined by identity of the
Private object, so even if there are QNCs with the same properties,
they will not compare equal. This probably happens when a user roams
through different WLANs (e.g. from work via public transport to home
and then back), and each time the home WLAN pops up, it will beget a
new QNetworkConfiguration, not comparing equal to the previous one.

So, over time, we might collect a sizeable amount of
QNetworkConfiguration objects just sitting in the cache without ever
being able to actually use an associated network session, because they
all have long since expired.

To fix, prune expired network sessions, and thus their associated
QNetworkConfigurations, from the cache. To not run every time, prune
only when this size of the cache is larger than 16 (arbitrary number).

Change-Id: I11a636f45ccf67420f84b1c79a4453a144de7c5c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-07-19 16:36:26 +02:00
Allan Sandfeld Jensen
34e457e873 Parse PNG cHRM chunks
Used for setting primaries without a full ICC profile.

Change-Id: I6dd8e62ca15bf1f86e7bbc01aaf8e0bd85803071
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2019-07-19 16:29:26 +02:00
Tasuku Suzuki
f0f46ade9e Fix SOURCES duplication in tools/bootstrap on macOS
Three *_unix.cpp are added twice for unix and for mac

Makefile:14766: warning: overriding commands for target `.obj/
qfilesystemengine_unix.o'
Makefile:14037: warning: ignoring old commands for target `.obj/
qfilesystemengine_unix.o'
Makefile:14913: warning: overriding commands for target `.obj/
qfilesystemiterator_unix.o'
Makefile:14184: warning: ignoring old commands for target `.obj/
qfilesystemiterator_unix.o'
Makefile:15071: warning: overriding commands for target `.obj/
qfsfileengine_unix.o'
Makefile:14342: warning: ignoring old commands for target `.obj/
qfsfileengine_unix.o'

Change-Id: Ia5f9d2873f738081c2d1e763efbdfc64209aaf7d
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2019-07-19 23:18:53 +09:00
Thiago Macieira
89e0c2854a Fix QStorageInfo inability to parse really long mountinfo lines
Docker creates really long lines due to the multiple levels of overlays
in the overlayfs. Our limit of 1024 bytes was too short.

[ChangeLog][QtCore][QStorageInfo] Fixed a bug that caused QStorageInfo
to be unable to report all filesystems if the options to mounted
filesystems were too long (over 900 characters, roughly), such as those
found in Docker overlay mounts.

Fixes: QTBUG-77059
Change-Id: I6aed4df6a12e43c3ac8efffd15b1ba4231e60b4a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-07-19 05:18:23 -07:00
Tor Arne Vestbø
c5ab86976b macOS: Modernize and clarify transient parent window level inheritance
Task-number: QTBUG-71480
Change-Id: Ia026427844a674f6b36804571a897dc6f16364fa
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-07-19 11:02:11 +00:00
Allan Sandfeld Jensen
5c351da046 Protect against integer overflow in painting transformed images
Makes it safe to sample pixel coordinates above 32767.

Fixes: QTBUG-76829
Change-Id: I5965afef1bd65106fcfc130dd37572309eacbe42
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2019-07-19 11:55:50 +02:00
Tor Arne Vestbø
af683471bd macOS: Add QCocoaWindowManager for dealing with window levels
Moves and improves the logic for lowering splash screens to a dedicated
window manager, which will learn more tricks in patches to come.

Change-Id: I8b8fd1dd78fdaf6f106a59c84d2a59254f3539c3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-07-19 10:56:23 +02:00
Qt Forward Merge Bot
f07d5e4a78 Merge "Merge remote-tracking branch 'origin/5.13' into dev" 2019-07-19 10:45:40 +02:00
Qt Forward Merge Bot
8f0790dd90 Merge remote-tracking branch 'origin/5.13' into dev
Change-Id: I999ba23a27cd897017d15c6ffe41ea8cd008ffb9
2019-07-19 01:00:41 +02:00
Eirik Aavitsland
82aabafada Fix loading of image files with wrong, but known, file name extension
If QImageReader recognized the suffix of a file, it would by default
not check if the file contents matched the claimed format. Hence, a
valid but misnamed image file would fail to load.
Fix by adding contents check for suffix-recognized files.

[ChangeLog][QtGui][Image] Loading of image files having a file name
suffix for a different image file type has been fixed. QImageReader
will now ask the suffix format handler to confirm the file contents
(canRead()), and fall back to normal file content recognition on
failure. This implies a slight behavior change in
QImageReader::loopCount(), ::imageCount() and ::nextImageDelay(): For
an unreadable file with a recognized suffix, they would earlier return
0, while they now will return -1, i.e. error as per the documentation.

Fixes: QTBUG-42540
Fixes: QTBUG-68787
Change-Id: I205e83f29ed7190cbcae95dab960232544d012f6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-07-18 16:05:57 +02:00
Tor Arne Vestbø
92563a2453 macOS: Allow overriding NSKeyValueObservingOptions for QMacKeyValueObserver
Change-Id: I6dc0f7c542ccfb768c1cd8688168c415e2c8a087
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-18 16:00:29 +02:00
Volker Hilsheimer
de775f2e62 macOS: activate correct object when using multiple QSystemTrayIcons
Since we need to set the delegate on the defaultUserNotificationCenter,
which is a gobal object, we have to update the delegate when we show
the message. Otherwise, the last delegate created and set will receive
the notification, and the last QSystemTrayIcon created will emit the
activated signal.

Before clearing the delegate upon destruction, make sure that it's
the right item first.

Also updating coding style in the respective parts of the code, and
plugging a memory leak.

Change-Id: Ife62ae0776a5a610a6fd735b2959b807c3a410c7
Fixes: QTBUG-77003
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-07-18 15:26:49 +02:00
Giuseppe D'Angelo
907923b7ca qmake: fix move semantics
ProFunctionDef is move-enabled, meaning its `m_pro` field can
become nullptr. Its usage in the assignment operator and the dtor
must therefore be protected with a check.

Amends 9c63ad562b.

Change-Id: I0c77b07dc83969565480bbb9d9fc80751d4246b1
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-07-18 12:55:33 +00:00
Eirik Aavitsland
7f948d9eff Disable experimental xcb native painting config option by default
Saves 13% on the binary size.

Change-Id: I3be0957b80eec5d3c8b75b4d3f1784e4bd6b5e2a
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2019-07-18 13:44:48 +02:00
Marc Mutz
eaceabe9ac QHostInfo: port from recursive to non-recursive mutex
It turns out that the only reason a recursive mutex is used was
because work() was locking it. But work() was only ever called from
functions that already had locked the mutex themselves, and kept it
locked across the call to work(). Clearly mark work() as expecting to
be called with the mutex held (by renaming the function to
rescheduleWithMutexHeld(), then drop the mutex locking from it.

After this change, a non-recursive mutex suffices, so save the memory
allocation and extra complexity involved with recursive mutexes.

Looking at the non-QT_CONFIG(thread) code in rescheduleWithMutexHeld(),
one might be tempted to expect a recursive mutex, since that code
calls QHostInfoRunnable::run() directly, which, in turn, recurses into
QHostInfoLookupManager whence control came, under mutex lock. But in
non-QT_CONFIG(thread) builds, QMutex is but an empty shell, all of its
operations are no-ops, so no possibility for deadlock, either.

Change-Id: Ic01d90c2ed3995b66ccf946d146fdaa6f9af3d8b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-07-18 11:38:02 +00:00
Mårten Nordheim
d35aedc125 tst_qnetworkreply: Use object.connect() to get rid of warning
warning C4573: the usage of 'tst_QNetworkReply::connect' requires the
compiler to capture 'this' but the current default capture mode does not
allow it

Change-Id: Ic9fd526fedf7c52e53e2b1136834c10bf4cd0ea9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-07-18 12:30:02 +02:00