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>
1. Use per-case QNAM objects
2. In a slots (connected to QNetworkReplies) - if an error detected - stop
the event loop (no reason to continue waiting) and then do normal
QVERIFY/QCOMPARE things.
3. In tests, check QTest::currentTestFailed after the event loop returned -
if an error was detected by a slot, no need to continue with QCOMPARE/QVERIFY
in the test itself.
Task-number: QTBUG-77053
Change-Id: I3827a629a2749becd3dc6eee7fd6994d96441e65
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The textdate API methods are deprecated in favor of QLocale; so
suggest use of QLocale in place of them. Don't credit the deprecated
methods as being used where they aren't.
Change-Id: I0abcb1f69729760ae1b86cb8088e4158c0ad6010
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@qbc.io>
Allows us to reference captured variables and keeps the function
local to where it's used.
Change-Id: I609892888720202021862d26a74ceb50e232f356
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
So that the context can be referenced during initialization.
Change-Id: I9ec69b2431ba1ac6256cb2e969a76f515497e247
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Well, yeah, it technically does...
qcborstream.h:245:15: warning: declaration shadows a typedef in the global namespace [-Wshadow]
/usr/include/libkern/OSTypes.h:36:26: note: previous declaration is here
Fixes: QTBUG-75825
Change-Id: Idce141629dd34287808bfffd159ee2a75428bf12
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
When changing the primary screen, the various changed signals of
QScreen were out of order. Most notably, the wrong DPI value was
emitted since QGuiApplicationPrivate::processScreenGeometryChange()
checks and emits DPI and orientation as well. Rearrange the code to
assign new the values and emit DPI first.
Task-number: QTBUG-76902
Change-Id: If4037108391c36ab3a8bfcb9b2989d5bea41202f
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
fix the bloody test for good - the idea to have a shared QNAM (shared
by test cases in this test) was somewhat wrong to start with.
Fixes: QTBUG-77053
Change-Id: I5755e96ec988e2dd546f527f3f902fc43914b0b7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
As noted in RFC7230 Section 6.1 the 'Connection' options are case
insensitive.
https://tools.ietf.org/html/rfc7230#section-6.1
Change-Id: I80b98d82eaa5572d38a6c3f99383bc059ec91c54
Fixes: QTBUG-76990
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The public QWidget::create still has them, but we don't need to
propagate them on - that just makes debugging the window creation
flow harder.
The window argument to QWidget::create is technically used to
guard an early exit in the function, but to keep behavior the
same we leave it for now.
Change-Id: Ic0287575aa25f1272e216adc1b75e34d6f55f6d9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This reverts commit a9246c7132.
The QWidget machinery is way to fragile to reset the winId under the
feet of QWidget like that. We would potentially need to include all
the logic in QWidget::destroy. This also ties into the flow between
QtGui and QtWidgets during window closing, which is still unresolved.
Change-Id: I168048a63c89796398eb5331a80ce3e5c8d9a208
Fixes: QTBUG-76588
Task-number: QTBUG-69289
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
A switch statement was comparing enum values of a different enum.
Change-Id: I578f79b15b1007afaa64cd3a2a80d6a75d3bed77
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
The icon provided was ignored, even though NSUserNotification provides
the option to specify a contentImage.
The message popping up will show that image on the right side of the
notification; it will not repace the application icon on the left side.
[ChangeLog][Widgets][QSystemTrayIcon] On macOS, show the icon passed
into showMessage in the notification popup
Change-Id: I8ecda7f893006e74a4f35f37ddc07063ebfe4e83
Fixes: QTBUG-76916
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
A function may almost always have static storage duration, but that
does not necessarily mean that we can store and load pointers to them
without memory ordering. Play it safe and use store-release and
load-acquire for them (which combines to ordered for the fetchAndSet
call in qInstall*Handler(), as we don't know what the caller will do
with the returned function pointer).
Also change the initial value of the atomic pointer to nullptr.
Nullptr already signified the default handler in qInstall*Handler(),
so the API doesn't change. But by using nullptr to mean default, we
place these variables in the BSS segment instead of TEXT, save dynamic
init, or at least a relocation, and we dodge the smelly comparison of
function pointers, using comparison against nullptr instead.
Also, as a drive-by, put the call to ungrabMessageHandler() in a
scope-guard. Both the message handler, as well as the Qt code calling
it (toLocal8Bit()!), may throw, and that would stop all further
logging. In Qt 5.9, we can't use qScopeGuard(), yet, so use a local
struct calling ungrabMessageHandler() in its dtor.
The code still has one problem: When a logging action is underway, and
another thread exchanges the message handler, we might still execute
code in the old handler. This is probably not a problem in practice,
since no-one will use a dynamically-compiled function for logging
(right? :), but should probably be documented or fixed. This patch
does not address this issue, though.
Change-Id: I21aa907288b9c8c6646787b4001002d145b114a5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit cd401b74a1)
(cherry picked from commit ea16c860bd75a35134ebb1d4f3be5db58f4a4e21)
The call to QFileDevice::unsetError() in QSaveFile::open() does
not clear QSaveFilePrivate::writeError. Clear it in addition.
Fixes: QTBUG-77007
Change-Id: I5e5009750f1726d1c74c1b4eb1c33f3a5393fe4f
Reviewed-by: David Faure <david.faure@kdab.com>
HFS+ filesystems do enforce NFD normalization, so the test worked for
those filesystems. But on APFS, the filesystem is normalization-
insensitive but preserves it, so our transformation caused valid files
to be rejected.
This commit also optimizes the solution for all systems too. Instead of
converting from 8-bit to UTF-16 then back to 8-bit (allocating memory in
both steps), we only convert to UTF-16. And if we detect the locale is
UTF-8, then we use the further optimized QUtf8::isValidUtf8 function
that doesn't allocate any memory at all (ditto for US-ASCII, the case of
someone running with LANG=C).
Fixes: QTBUG-76522
Change-Id: Ief874765cd7b43798de3fffd15aa0d81620ad317
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The old handler only marked mouse events associated with mouse messages
synthesized by the OS with Qt::MouseEventSynthesizedBySystem when these
messages resulted from touch screen, not tablet input. Quick seems to
depend on this behavior.
Fixes: QTBUG-76617
Change-Id: Ib863d73ae9325f9a19d8a175817fef4e82f7df0b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Skip printsupport subdirectory if printer feature is disabled. Also
removed android-embedded condition for the plugin: Such a
configuration should just disable the printer feature.
Fixes: QTBUG-76941
Change-Id: Ifca7d2311a575c1589ad6a87a775bd016591ee2c
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
The previous code handled only some error codes, in a very inefficient
way, for some code paths. This change standardizes error handling using
a helper function that maps winsock WSAE* codes to Qt error codes.
The test for connecting to unreachable hosts or ports is now more
generic, and enabled on Windows, where it passes in local tests,
but dependency on network configuration still makes it fragile,
so ignoring some failures without completely skipping the test.
[ChangeLog][Network][Windows] Correctly emit errors when trying to
reach unreachable hosts or services
Change-Id: Icaca3e6fef88621d683f6d6fa3016212847de4ea
Fixes: QTBUG-42567
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Depending on the active QPA plugin, QPixmaps may now be created and
used also in non-main threads. But QPixmapCache is not designed to be
used from such threads, so add guards to ignore such access attempts,
both from application code and from Qt library code.
Such unsafe access would often cause a cryptical "~QObject: Timers
cannot be stopped from another thread" warning; that also disappears
with this fix.
[ChangeLog][QtGui][QPixmapCache] Ignore unsafe access from non-main
threads
Task-number: QTBUG-76694
Task-number: QTBUG-72523
Change-Id: Ia2db37e528aec08bfb48808630bdf5e543689039
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The host architecture detection binary's file extension is determined by
the host platform, not the target platform. Respect the host variable
that's set in configure.json.
This amends commit d9fb502.
Change-Id: I134cd7cf12d6a6fe458ac5e37c48dd311d6c4418
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Counting absolute paint events is fragile, as there are no guarantees
that a single call to QApp::processEvents only delivers a single paint
event to a widget. As of QTBUG-76566, we see that the items occasionally
receive three calls to paint, which can be simulated by activating other
windows while the test is running and waiting for events to be
processed.
Instead, verify that we do receive any paint events as the first test,
and then verify increments when we expect updates.
This also reverts change 24b9424adc.
Change-Id: Ib51853e918f31acd3aea10d4109c95f34012a29f
Fixes: QTBUG-76566
Reviewed-by: Dimitrios Apostolou <dimitrios.apostolou@qt.io>
Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
The QTest::mouseMove calls are not reliable, and seem to produce
flakiness, at least on WinRT. Removing them, and only depending on
handling of the synchronously delivered QMouseEVent for simulated
mouse moves.
Also, initialize the expected cursor shape from an empty scene;
this avoids that showing the view with the cursor accidentially
on an item results in the wrong default shape. Remove hard
coded coordinates, just test what we know.
Fixes: QTBUG-73545
Change-Id: I6f81d6b16bb613ec77aaa776d6a80aac739aeb58
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Android is also unix, so can pick up the host 'arch' binary when
rerunning configure. This patch splits the names so we don't end up
confusing target and host binaries.
Task-number: QTBUG-76445
Change-Id: Ib65251a514e45ad8873f523d71c17e13e56ea58a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The "None" and "Custom icon" cases where using the same value for icon
type, which resulted in both options showing the application icon.
Use -1 to indicate the custom option, and treat all other options
the same.
Task-number: QTBUG-76916
Change-Id: Ib715f5d328175bd6e221b3f507087954fa542838
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
In auto-test-enabled builds, QHostInfoCache can be enabled and
disabled using qt_qhostinfo_enable_cache() at any time. We cannot rule
out that users use this function, or, indeed, that the auto-test never
gets a threading stress-test. Under the assumption, then, that
QHostInfoCache::enabled can be set by any thread at any time, and is
read by any thread using QHostInfo::lookupHost(), we're presented with
a data race, thus UB.
Fix by making the accesses to QHostInfoCache::enabed atomic. Relaxed
operations are suffcient, as the bool is the only data of interest in
these situations. In particular, access to the cache itself is
protected by the cache's mutex.
We use std::atomic<bool> because QAtomicInteger<bool> doesn't exist on
all implementations, but std::atomic<bool> must. Commit a0faf9e236 set
the precedent that it works.
Change-Id: Ia1766753bb54c5fe8d8447b51a49a96a7a853eef
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Blocks are likely to have been created in a differnt thread from the one
performing their deletion, so we need an acquire fence.
The rest of the atomics use in the class looks ok, but nevertheless warrants
a deeper analysis.
Change-Id: I1571ded3a06695b0d58b5bf1d80d6283ac21f959
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6fa34930c2)
(cherry picked from commit 51bcc7e07e2bb5b42bb200dcd5269e9e9e2fe240)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The pointer value is not the only data we're interested in, but
instead points to indirect data, so we need a release fence on store
(present) and a corresponding acquire fence on load (was missing).
Change-Id: I51f8251c0c7f4056192880430f2be5e0836dbed6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6f84829031)
(cherry picked from commit 4cc6e1419294a729e53d698bace2254903c1429b)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
As with widgets, items that are disabled should not receive any input
events.
Similar to QGraphicsScene, which ignores disabled items when handling
mouse presses, the view should also ignore them when handling mouse
moves to update the cursor.
Since QGraphicsView only adjusts the cursors on mouse moves, reenabling
an item that is currently under the mouse will not change the cursor.
This is consistent with other changes of item attributes that would
position the item under the mouse (such as moving it). The overhead of
hit-testing items for every such attribute change would be too large,
and applications can generate a mouse move event if they really need
to adjust the cursor in all situations.
[ChangeLog][QtWidgets][QGraphicsView] Ignore disabled items when setting
the mouse cursor.
Fixes: QTBUG-76765
Change-Id: Ifcd31fc0581e8421e58eeb436a55b031909eed7e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The tests send QEvent::MouseMove events to the view, but don't fully
construct the event with both local and global position. Consequently,
QMouseEvent will use QCursor::pos as the global position, which is
unreliable, as QTest::mouseMove can not guarantee that the mouse really
moves - when running the tests locally on e.g macOS, it never does.
So instead construct the QMouseEvent with the trivially calculated
global position.
Change-Id: Ic4c914e3af7f15751545080d4743b06d3887cce8
Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
This patch amends 730cbad882
The issue was that the event reader thread (QXcbEventQueue::run()) can enqueue
events sometime between GUI thread has last time peeked at the queue and before
it has called waitForNewEvents() and hence started waiting for more events (via
QWaitCondition). This scenario is even mentioned in the QWaitCondition documentation:
"[..] if some of the threads are still in do_something() when the key is pressed,
they won't be woken up (since they're not waiting on the condition variable) and
so the task will not be performed for that key press. [..]"
And if there are no more events on the X11 connection, the waitForNewEvents()
in QXcbClipboard::waitForClipboardEvent() would timeout.
Fixes: QTBUG-75319
Change-Id: I8990a2a0c00571dfc334fb57d616dee999042885
Reviewed-by: Igor Kushnir <igorkuo@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Implicit capture of 'this' in [=] is deprecated in C++20.
Fix by using explicit captures.
Change-Id: I1633446f4670202b0d1aca938d8c27dbc0c1411e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The plain bool variable wasDeleted is set to true in the
QHostLookupManager dtor before the call to clear(), which calls
waitForDone() on the thread pool performing the lookups. All tasks on
the thread pool start by checking this variable so as to return early
when destruction is in progress. But the check was outside the
mutex-protected area, so as a non-atomic load, without a
happens-before relation to the write, this is a Data Race, thus UB.
Fix by moving the check past the mutex locking into the critical
section. This way, tasks that were waiting for the mutex after seeing
no wasDeleted before get the message reliably.
This does not introduce a dead-lock, since the call to waitForDone()
is outside any mutex protection leaving a window for the tasks to
obtain the mutex and react on wasDeleted.
Change-Id: Ied4b9daa7dc78295b0d36a536839845c4db2fb78
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Factor out the screen area check to a separate helper and apply to
restoredGeometry, too, fixing an oversight of
2f2bfc4e59.
Change-Id: I795d8d5e3cddb5e986c96c08a342d69063d04970
Fixes: QTBUG-76900
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
restoredFrameGeometry is only used for a sanity check in format
version 0, add a comment and remove code.
Task-number: QTBUG-76900
Change-Id: I797b07d069f8568cb39541bcbe9009935a4a79f7
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
This is an enabler for supporting pen color for color fonts in
Qt Quick.
Task-number: QTBUG-74761
Change-Id: I3e605f939e6677cbbd4a650ae7998dea8fd2d7a9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
A previous change to QLineEdit::sizeHint() has caused the QSpinBox
arrows to break the widget frame on a high-DPI display with some
particular scale values like 150 or 175%. This change updates
QLineEdit::sizeHint() so that it has a minimum height, using the same
values used in 5.11.
Fixes: QTBUG-76047
Change-Id: I21f3e736da473b10fdf52e5a60e5fc5d07f270a1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Color fonts may also contain regular alphabet characters that
should be rendered with the current pen. In Qt, however, these
characters were drawn into the cache with a default pen color
of black.
Since all characters in a font is currently backed by the same cache,
and it would require a lot of plumbing to get around this, a step
in the right direction is to include the current pen color in the
cache as long as it is an RGB cache. This means that drawing
text with the color font with different pen colors will create
different caches.
There is no API to select font color on Freetype currently, but
this problem has also not been observed there, as the fonts
in question, with both regular and color glyphs, are not being
detected as color fonts (so the text color will be correct).
So Freetype will be left out for now.
[ChangeLog][QtGui][Text] Fixed bug where regular text rendered
with a color font would always display in black.
Task-number: QTBUG-55096
Task-number: QTBUG-74761
Change-Id: Icc7dbf73241db1e7cc6a0de18c2de927aeecf713
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Remove the config.unix condition from the ccache feature. This enables
us to use ccache for non-Unix cross-builds like MinGW on Linux.
Change-Id: I3b108c2288754ad5dd05834e3d5a487c2da4ac00
Fixes: QTBUG-76681
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This reverts commit 224a60989e.
Turns out that we cannot just untangle the determination of
source root and build root, because this breaks the assumption
that every .qmake.conf results in a separate .qmake.cache in the
build tree. QTBUG-76140 must be fixed differently.
Fixes: QTBUG-76907
Change-Id: I5c0a3719d5e00a0f1cacad51651b47c1f284d22d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The header clean command must not be prefixed by "@echo ...", because it
now starts with "$(CXX)" which already is prefixed.
This amends commit 6fa5dfdd.
Change-Id: I5c2e0d2c2ed91c7232fce0a4a49db0fccfdc005d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
A blinking white dot could appear on dark backgrounds on Windows 7/8/8.1.
It was caused by a workaround added to trigger the on-screen keyboard
on the Microsoft Surface. This change effectively restricts that
workaround to Windows 10, where the blinking dot was not an issue.
And anyway, impact over the Surface functionality should be minimal,
as all models produced since 2015 only support Windows 10 (and it's
unknown if the workaround was ever necessary for early models running
Windows 8.1).
Fixes: QTBUG-74492
Change-Id: Ic9b9c0f71f23b75212054c56a29796cf0efa109a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
In some cases, the wheel event coordinates would be incorrect, as the
local coordinates were being determined relative to one window and
the event being sent to another window, possibly incorrect.
Fixes: QTBUG-75820
Change-Id: I4c3c4c6c4688bd9232d67ce4052d24365f6aea3a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This reverts commit 9a25d27b9d58316dee5d2305135d2d74ad5d51e7.
The QSKIP is no longer needed as the imap server's certificate
was updated
Task-number: QTBUG-76610
Change-Id: I1007ce50d6f7f6258fdeb8894c66678a660b03ca
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Because it is. It's just QCoreApplication::postEvent(), which is thread-safe.
It also _has_ to be, because we recommend to use deleteLater() to delete
QObjects that live in another thread:
Quoting the ~QObject() docs:
> Warning: Deleting a QObject while pending events are waiting to be delivered
> can cause a crash. You must not delete the QObject directly if it exists in
> a different thread than the one currently executing. Use deleteLater()
> instead, which will cause the event loop to delete the object after all
> pending events have been delivered to it.
If deleteLater() is not thread-safe, it cannot be used for one of its intended
purposes.
Change-Id: I333d506b42bdfcdff00fe6cefa234c21865625a6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>