Commit Graph

47987 Commits

Author SHA1 Message Date
Ulf Hermann
5c808073af Extend QSequentialIterable and add QAssociativeIterable
And add mutable iterators. This requires some refactoring of the
existing iterators.

Task-number: QTBUG-81716
Change-Id: I61b3a3e8c0df5fd449679257a29d9f0c3d19c4f0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-09-19 11:14:30 +02:00
Ulf Hermann
b30801f64d Un-export QVariantRef and QVariantPointer
Templates should not be exported.

Change-Id: I1378414a6e146eab125e43670e538afec00cd917
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-09-19 11:14:23 +02:00
Jesko von Monkiewitsch
43108bc6fa Rename QVarLengthArray's private realloc() to reallocate()
This will enable run-time debugging on Windows, using
_CRTDBG_MAP_MALLOC, which uses #define to override the
standard library memory management functions, including
realloc.

Fixes: QTBUG-86395
Change-Id: I51975dd74cab0ae8309436c86d17a59074c561e1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-09-19 10:55:52 +02:00
Ahmad Samir
340b60ea2b QDir: Use QDoc syntax
Replace Note/Note: with \note.

Change-Id: I9a4cd79836fced9d858a478304a03e6c4bccfed5
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-09-18 23:52:15 +02:00
Mårten Nordheim
107ff4c1d6 Q(Any|Utf8)StringView: move array size deduction feature to fromArray
The constructor taking an array literal will now stop at the first
null-terminator encountered.

And fromArray is introduced which only supports array literals.
Constructs a view of the full size. Explicit so it shouldn't be
surprising.

Change-Id: I1497c33a5c12453a95e87c990abe6335b2817081
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-09-18 23:34:52 +02:00
Mårten Nordheim
bbe7570ddc QByteArrayView: move array size deduction feature to fromArray
1. Make the ctor unable to construct a QByteArrayView from
array literals other than 'char'.
    With the new behavior it would either be (very likely) unintended to
    pass e.g. a std::byte array to the ctor. And it would be confusing
    because you would get different sizes based on signed-ness.
2. Introduce fromArray
    Only supports array literals. Constructs a view of the full size.
    Explicit so it shouldn't be surprising.

Change-Id: Ifdb55eb21057dfe7053b2561bd81e2c9825e9bc6
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-09-18 23:34:49 +02:00
Giuseppe D'Angelo
7a5e0c5712 QNAM: try to send headers and body together
For HTTP connections, QNAM defaults to opening its TCP socket in
unbuffered mode. This means that Qt will send the data written
into the socket right to the kernel, queueing only if the kernel
says it doesn't want more data for the moment being.

QNAM itself then uses separate write() calls to write the HTTP
headers and the body of the request (like POST or PUT). These 2+
writes result in headers and body being sent over different TCP
segments -- even if, in principle, a POST with a few bytes of data
(e.g. a HTML form, or a REST or SOAP request) could fit in the same
segment as the request.

Multiple writes like this interact extremely poorly with other
TCP features, e.g. delayed ACKs, Nagle's algorithm and the like.
In a typical scenario, the kernel will send a segment containing just
the headers, wait for the ACK (which may be delayed), and only then
send the body (it wasn't sent before because Nagle was blocking it).
The reply at this point is immediate (because the server can process
the request and starts replying), but the delayed ACK is typically
40-50ms, and documented up to 500ms (!). If one uses QNAM to access a
service, this introduces unacceptable latency.

These multiple writes to the OS should be avoided.

The first thing that comes into mind is to use buffered sockets.
Now, there are good reasons to keep the socket unbuffered, so we
don't want to change that. But the deal breaker is that even buffered
sockets won't help in general: for instance, on Windows, a buffered
write will immediately detect that the socket is ready for write and
flush the buffer right away (not 100% sure of why this is necessary;
basically, after populating the QTcpSocket write buffer, Qt enables
a write socket notifier on the socket -- notifier that fires
synchronously and immediately, without even returning to the event
loop, and that causes the write buffer flush).

Linux of course offers the perfect solution: corking the socket via
TCP_CORK, which tells the kernel not to send the data right away but
to buffer it up to a timeout (or when the option gets disabled
again, whichever comes first). It's explicitly designed to support
the case of sending headers followed by something like a
sendfile(2). Setting this socket option moves the problem to
the kernel and we could happily keep issuing multiple writes.

Ça va sans dire, no other OS supports that option or any other
similar option.

We have therefore to deal with this in userspace: don't write in the
socket multiple times, but try and coalesce the write of the headers
with the writing of the data. This patch implements that, by storing
the headers and sending them together with the very first chunk of
data. If the data is small enough, this sends the entire request
in one TCP segment.

Interestingly enough, QNAM has a call setting TCP_NODELAY
currently commented out because Qt doesn't combine "HTTP requests"
(whatever that means). The call comes all the way back
from pre-public history (before 2011) (!). This patch doesn't
touch it.

Fixes: QTBUG-41907
Change-Id: Id555d14e0702c9f75c3134b18277692eb3659afe
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-09-18 23:19:41 +02:00
David Faure
354ea7bd96 QMimeDatabase: fix performance regression when using the internal XML
That XML was parsed over and over again, because the QMimeXMLProvider
was re-created instead of re-used.

Pick-to: 5.15
Change-Id: I07ff005d3f238afc1490b69a58cf4815e67d418c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-09-18 22:18:49 +02:00
Shawn Rutledge
1a3863147d Emit CancelGrabExclusive when one grabber is replaced by another
Qt Quick Pointer Handlers depend on this behavior:
QQuickPointerHandler::onGrabChanged() receives only the grabber that
was losing the grab or the one that is receiving it, not both at the
same time.  UngrabExclusive means the original grabber simply
relinquished the grab by setting the exclusive grabber to null.
CancelGrabExclusive means the new grabber took over the grab that the
old grabber had before.

Task-number: QTBUG-86729
Change-Id: Iefca6fe91b11fcb03d2c6ac3598841c924facb22
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-09-18 20:11:51 +00:00
Eirik Aavitsland
f1c1f44481 Gif decoder: fix read error caused by ub check
The recently added check to avoid negative-bitshift ub ignored that
the algorithm will sometimes use a negative bitcount value as a
flag. This caused reading failure for some frames.

Pick-to: 5.15 5.12
Fixes: QTBUG-86702
Change-Id: I4c247a7eb6102f9b51cc8ac708c60db80d609e38
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-09-18 21:37:10 +02:00
Joerg Bornemann
2cbeacd2cd qmake: Support multiple /MERGE:from=to options in MSVC generator
Any but the last /MERGE:from=to option passed to QMAKE_LFLAGS was
ignored. Now, the first options gets a <MergeSections> tag and all
further options are added as AdditionalOptions, because vcxproj files /
the VS property editor do not support multiple MergeSections entries.

Pick-to: 5.15
Fixes: QTBUG-86062
Change-Id: I65bddf0b8c7ed6c162008d6ad1b58c2aba2d07d9
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2020-09-18 18:48:58 +00:00
Julien Schueller
5a8555c53f CMake: Fix FindWrapRt
We must use the LIBRT location instead of LIBRT_FOUND which is not set anywhere.
I failed to replace this one in my previous patch.

Change-Id: I6e2df82c31e29018d99afec1eecfb80a321fddd4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-09-18 20:25:58 +02:00
René Meusel
cdc7bff115 Handle NSEvent*MouseDragged in QCocoaWindow::startSystemMove()
The documentation for [NSWindow performWindowDragWithEvent:] only
mentions mouse-down events, but starting a drag from move and drag
events works too, so include them as well.

Pick-to: 5.15
Fixes: QTBUG-85105
Change-Id: Ib6c29ed4035bfccc61d50a7f95f564fb3d56fcf6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-09-18 17:47:50 +00:00
Friedemann Kleint
af22ccf560 Fix a double deletion in QDomAttr::setNodeValue()
Check the reference count before deleting. Patch
as contributed on bug report.

Pick-to: 5.15 5.12
Fixes: QTBUG-86547
Change-Id: I2cb197e3eeda7ade2442c23f6b4f1ae6ff2ff810
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-09-18 17:35:22 +00:00
Mitch Curtis
1dbaf037a8 Output QSysInfo::productType() and productVersion() in test config line
This makes it easier to know which values to use in BLACKLIST files
for a flaky test, for example.

Pick-to: 5.15
Change-Id: I12af99d68f97e016aa42be9ae9d70de5fc0a58ed
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-09-18 16:07:20 +02:00
Morten Johan Sørvig
6e806b5339 Say hello to PixelGadget
Utility for visualizing and debugging high-dpi rendering
using QPainter, at different (fractional) scale factors.

In addition contains prototype code for mitigating
painting artifacts such as drawing outside the clip
rect when scaling.

Change-Id: I44f39315ad9674790d51413dddf41e3a51043da6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-09-18 16:07:20 +02:00
Morten Johan Sørvig
30e776fb1b Say hello to DprGadget
DprGadget displays the devicePixelRatio for the current
screen using a large friendly font, as well as the
platform and environment inputs used for determining
the DPR.

Change-Id: Id619edad181eb7717f18eb98af341d6582a843a1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-09-18 16:07:20 +02:00
Edward Welbourne
15d70c9053 QDateTimeParser: skip some needless braces
Simplified the logic around reconciling hour12, ampm and hour in the process.
Mindless coding-style tidy-up.

Change-Id: I0b7cabc57539d0d7201fef33e0120b84f4bb4994
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-09-18 16:07:19 +02:00
Sona Kurazyan
461b28c89d Improve docs for QtFuture::Launch::Sync policy
Updated QFuture docs to be more precise about QtFuture::Launch::Sync
policy.

Change-Id: Ic267c71f858e04a47ea1fc0996ea342d5eae7744
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-09-18 16:07:19 +02:00
Alex Trotsenko
c6d1e7ad38 QWinEventNotifier: reinterpret 'int signaledCount' as a 'bool signaled'
In fact, this variable can take only two values: 0 and 1. By
interpreting its value as boolean, we can use relaxed store operations
instead of atomic increments. This is safe, because it's guarded by
'activateEventNotifiersPosted' variable, which already provides a
release/acquire semantic.

Change-Id: If9adb7d022f1500ee7e8b61f336d8732f9b88d4c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-09-18 17:07:19 +03:00
Andrei Golubev
8716413afc Update QByteArray documentation relevant to prepend optimization
[ChangeLog][QtCore][QByteArray] QByteArray is a prepend optimized
container similar to QList.

Task-number: QTBUG-84320
Change-Id: I45ed1cb75414930f5998be58bfcfe343b1790331
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-09-18 10:02:04 +02:00
Paul Wicking
465ddfc870 Doc: Add links to Qt 6 changes files from module index
Task-number: QTBUG-84051
Change-Id: Iac25df135c9d73a990b41243e08cd38ea78296a4
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2020-09-18 09:59:38 +02:00
Laszlo Agocs
8fe16fef28 rhi: Expose compute threadgroup limits in ResourceLimits
As OpenGL ES and Vulkan ruin the day with the spec mandated minimum
value for max threads per threadgroup being only 128, clients need
a way to decide if their compute shader (local_size_*) is suitable
for use at run time.

Change-Id: I72b4fc97032406340623add82ea4d9544ebe9fdc
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-09-18 09:49:54 +02:00
Eirik Aavitsland
6f2c7469f8 xpm handler: fix read error caused by off-by-one in overflow check
The recently introduced overflow check for 8 bit images was too
aggressive, causing the last pixel on each line to be rejected.

As a driveby, add the same (fixed) overflow check also for 32bit
images.

Pick-to: 5.15 5.12
Fixes: QTBUG-86691
Change-Id: I62e4d5884e314f1171cb5a3e2c48657ce7259676
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-09-18 09:37:46 +02:00
Topi Reinio
679ec56d95 Doc: Mark QProperty as being available since Qt 6.0
Change-Id: I9ab3dda38682c75526239a5ac4a0f5c7b2dbb44a
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-09-18 09:21:48 +02:00
Jarek Kobus
d76c472743 qmake: Compile fix
This code, after applying it to linguist, didn't compile.

Change-Id: I25011a44ca059a149f041f8f07848232883140cc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-09-18 09:01:42 +02:00
Eskil Abrahamsen Blomfeldt
f3ecac059d Fix running with placeholder screen and high-dpi enabled
After we started defaulting to high-dpi enabled, it was discovered
that it does not work correctly with the placeholder screen. Since
the placeholder screen has no physical size, and the default
implementation of logicalDpi() divides by the physical size, we
got a scale factor of NaN in the high-dpi code.

The effect of this was that the nooutput test in Qt Wayland would
fail, because it did not get the events it was expecting, since
the window geometry was never set to a valid rect in the
resize() call.

Task-number: QTBUG-86698
Change-Id: I7ee68db9a13446b414502ae0f26fd214531c673a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-09-18 07:44:22 +02:00
Sona Kurazyan
1c60f6bc5e Remove an outdated compiler check
Change-Id: I3af019b65835b2f82161d6f1c24feb0523a32c11
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-09-18 06:21:14 +02:00
Sona Kurazyan
e8843b5610 Remove a leftover of qlinkedlist test
Change-Id: I5f64ef8fc6134e0670606771a48d6f392c0fa223
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2020-09-18 04:51:34 +02:00
Edward Welbourne
ab75227c10 Fix deprecation warning in QIcon::actualSize()
The non-deprecated one called the deprecated one :-(
Inline the deprecated one and simplify, given the null pointer passed down.

Change-Id: I5b99053357fc3be109e61ccf1161835bf527b686
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2020-09-18 04:49:58 +02:00
Zhang Hao
3983afd48f QGraphicsView:QGraphicstextitem show error after lose focus
The reason for this bug is that after the TextItem loses focus,
the focusItem in QGraphicsScene is already empty.
When QGraphicsScene responds to the inputMethodEvent event again,
since focusItem is already empty,focusItem will no longer deliver events.

Fixes:QTBUG-85088
Pick-to:5.15

Change-Id: I329054333c2adec133d35318761612aca3afcf0d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-09-18 09:17:37 +08:00
Volker Hilsheimer
18cda2f669 Fix warning about discarded return value in QTranslator test
Use QVERIFY in test functions, and (void)tr.load outside.

Change-Id: I18d2eb3aeaf00f9f2bbe75d0a2d8b12569b541e1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2020-09-17 22:23:37 +02:00
Timur Pocheptsov
8be31ab2e1 Skip IPv6 address if DAD failed
Fixes: QTBUG-84256
Fixes: QTBUG-84253
Task-number: QTBUG-84254
Pick-to: 5.15
Change-Id: I6116c8a337cc85adbca1bbab2609d6627127fa46
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-09-17 19:21:06 +02:00
Shawn Rutledge
153dcfbbba Rename is[Begin|Update|End]Event, reimplement in QWheelEvent
These states correspond well with ScrollPhase, and this abstraction
makes it possible to handle wheel events the same way as mouse events
in Qt Quick: on "begin" we deliver to all Items and Handlers until
all points (the only point) are accepted; on "update" and "end" we
deliver only to the exclusive grabber, if there is one, and to any
passive grabbers.

Change-Id: I702dbd4f2c1bf5962eb3dbb9e4b725300a00a887
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-09-17 19:03:24 +02:00
Laszlo Agocs
55a7dd4581 rhi: Enhance compute dispatch docs
These docs are not part of the generated docs due to QRhi being private,
but nonetheless keep it useful.

Change-Id: Ic46aaa4cd329535c37fffcd514ba354dff4bfb5c
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2020-09-17 18:30:23 +02:00
Laszlo Agocs
dfa303c9af rhi: Improve srb hash perf somewhat
Do not qHashBits on the whole data that is at least 260 bytes, a big
part of it often unused. Just hash binding/stage/type and the first
resource pointer.

Change-Id: If9b3dc9acf36edf225302b1216d91e87b652b8ef
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2020-09-17 18:30:12 +02:00
Edward Welbourne
d0a929301a Rework checkValidDateTime() to avoid needless spec-checks
When we know the spec already, we can route to the correct branch of
the check directly. This also prepares the way for avoiding
duplicating the expensive check for LocalTime during
setMSecsSinceEpoch().

In the process, move duplicated code into massageAdjustedDateTime()
from its callers, to avoid adding verification to the duplication; and
clean up refresh{now: Zoned}DateTime().

Change-Id: I04d7a417110109d1f246a891b5aa94945821804b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-09-17 18:13:50 +02:00
Edward Welbourne
3a53fd9f23 Make moc ready for when null byte-arrays have null constData()
Various places in moc relied on the magic behavior of QByteArray, that
provided a non-null pointer to a null byte when the byte array was
null, resulting in crashes when QT5_NULL_STRINGS is turned off.  Fixed
them to cope with this (and optimised out some pointless effort, when
empty QByteArrays are involved, in the process).

Change-Id: I617a878eb2e9ac8be244080efa1f0de4ac9a68a2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-09-17 18:13:13 +02:00
Alex Trotsenko
4e27961db9 QEventDispatcherWin32: remove unused member
Change-Id: I9ec54aca7af190cd7ba7744ff52b05451dd7050a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-09-17 19:02:12 +03:00
Edward Welbourne
150828254a Tidy up QTimeZone method bodies
Use ternary operator form, or boolean algebra, for the short returns.
Handling invalid differently from valid isn't symmetric, they're
qualitatively different branches.
Skip a fatuous default-initialization.

Change-Id: I01a8a06055c315ecf08fc87d208808c0fe71eb31
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-09-17 17:57:30 +02:00
Edward Welbourne
2f6964ea00 Fix typo in QDateTime::fromSecsSinceEpoch() parameter name
Task-number: QTBUG-86400
Change-Id: I03f0cca08e05862e2a84ae6ec606a62713766462
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-09-17 17:57:30 +02:00
Volker Hilsheimer
861c4d8548 Deprecate implicit QPixmap conversion to QBitmap
It is lossy, so should be requested explicitly, using a dedicated
fromPixmap factory function.

Deprecate the constructor and assignment operator, and make the
constructor explicit.

[ChangeLog][QtGui][QBitmap] Implicitly constructing and assigning
to a QBitmap from a QPixmap has been deprecated, and the respective
constructor has been made explicit. Use the fromPixmap factory
function instead.

Change-Id: I68ce85b26c901415137b664a1db687021d48bae0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-09-17 13:26:50 +02:00
Volker Hilsheimer
e8b1e7e319 Fix warning from shadowing virtual function
QToolButton::initStyleOption is const. Apply some DRY while at it.

Change-Id: If29a52e828bbc2aa58df2852c4c434545acfef3e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-09-17 13:26:39 +02:00
Assam Boudjelthia
615b92008a Android: remove --no-daemon arg for Gradle
Allow Gradle builds to run using JVM daemon, this will improve the
current build time noticeably for clean builds and hugely for
incremental builds.

This will bring the Gradle build to comparable speed with a normal
Gradle build in Android Studio.

Task-number: QTBUG-86674
Pick-to: 5.15
Change-Id: Icc4267223802e4c9350b48099236650c023f868d
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-09-17 10:29:16 +03:00
Ömer Fadıl USTA
8d8b271fe9 Fix deprecation documentation about margin and orientation in QPrinter
There were a small typos about those methods and fixed with correct ones.

Fixes: QTBUG-86635
Change-Id: Ib853e502fdcdafdf3ddf7ef6d25d368ebc2a631f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-09-17 09:27:53 +02:00
Volker Hilsheimer
fe3bebbd68 Fix deprecation warnings in tests
Adjust to changes to QIcon::pixmap, QMetaType::type, and
QAbstractItemView::itemDelegate.

Change-Id: I9eb0331ef899131afc86c33f27feeee76331ffc8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-09-17 06:45:59 +02:00
Shawn Rutledge
b850322147 QPointingDevPriv::setExclusiveGrabber: emit grabChanged with point found
...not with the given point.  Since QEventPoint has a constructor that
takes an id, it's possible to write something like
 pointerEvent->setExclusiveGrabber(pointId, object)
which will construct a QEventPoint on-the-fly, containing only an id.
(That was unintentional, but perhaps useful sometimes.)
setExclusiveGrabber() looks up the persistent point, but if we emit the
signal with the given point, it is missing the device.  A handler
connected to that signal might reasonably assume that the point is a
complete instance; so we'd better emit the complete instance that we
found.  (OTOH if the given point was a detached instance, it might also
be unexpected that the signal emits the persistent instance instead of
the given instance.)  Amends 2692237bb1

Change-Id: Iee16363dcb22c1dc07b0cc0a81930218e22fa19e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-09-17 04:21:33 +02:00
Shawn Rutledge
8932e80d0c Add more QPointerEvent functions needed in Qt Quick
Change-Id: I87a874477b89eb3f5951930f03e305d896a24c2e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-09-17 04:20:58 +02:00
Thiago Macieira
d1fc991c6e forkfd/Linux: ask clone() to use the SIGCHLD as the termination signal
Because of these lines in the Linux kernel (kernel/fork.c, see [1][3]):

		if (clone_flags & CLONE_VFORK)
			trace = PTRACE_EVENT_VFORK;
		else if (args->exit_signal != SIGCHLD)
			trace = PTRACE_EVENT_CLONE;
		else
			trace = PTRACE_EVENT_FORK;

Without CLONE_VFORK (which we can't use), if the exit signal isn't
SIGCHLD, the debugger will get a PTRACE_EVENT_CLONE, which makes it
think the process we're starting is a thread, not a new process. Both
gdb and lldb remain attached to the child and when it later performs an
execve(), they get mightily confused. See gdb bug report[5].

The idea of not having an exit_signal was so that no SIGCHLD would be
delivered to the parent process in the first place. That way, some
misguided SIGCHLD handler (*cough* GLib *cough*) wouldn't reap our
processes. Unfortunately, what I didn't realize was that the kernel
sends SIGCHLD anyway (see [2][4]), so this defensive measure didn't
actually work. Consequently, we can pass SIGCHLD to clone() and get the
debuggers working again.

[ChangeLog][Linux] Fixed an issue that would cause debugging a Qt
application that uses QProcess to confuse both gdb and lldb if
the Linux kernel was version 5.4 or higher. Behavior outside of
a debugging session was not affected.

[1] https://code.woboq.org/linux/linux/kernel/fork.c.html#_do_fork
[2] https://code.woboq.org/linux/linux/kernel/signal.c.html#do_notify_parent
[3] https://elixir.bootlin.com/linux/v5.8/source/kernel/fork.c#L2432
[4] https://elixir.bootlin.com/linux/v5.8/source/kernel/signal.c#L1925
[5] https://sourceware.org/bugzilla/show_bug.cgi?id=26562

Fixes: QTBUG-86319
Pick-to: 5.15
Change-Id: I2fc68c725ba649218bd9fffd1633863613537d42
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: hjk <hjk@qt.io>
2020-09-17 00:43:47 +00:00
Alexandru Croitor
2ed99ff5ca Make usage of forkfd_pidfd in QProcess a configurable feature
Our CI cross-compiling arm qemu builds have issues in tests that use
QProcess, due to user-space qemu seemingly not supporting pidfds
properly.

Add a 'forkfd_pidfd' configure.json feature, which can be manually
disabled when configuring Qt, causing QProcess to do a regular fork
instead of using the new pidfd kernel feature.

This will help us avoid the regression of multiple tests failing on
the new Ubuntu 20.04 CI host images when they are run via qemu.

Task-number: QTBUG-86285
Task-number: QTBUG-86187
Task-number: QTBUG-86198
Change-Id: Ib2209d7e95126e0fb738bf59e39070d5a62c482f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-09-17 00:11:06 +00:00