Commit Graph

52095 Commits

Author SHA1 Message Date
Alex Trotsenko
f10491a9af QLocalSocket/Win: simplify flush()
Replacing a call to waitForWrite(0) with checkForWrite() changes
nothing in logic, but saves one system call. As a result, unused
functions in the QWindowsPipeWriter class have been removed.

Change-Id: I34ec6310d9659f59a720056b9be54e31f2193116
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-19 01:01:49 +03:00
Alexey Edelev
3329212815 Move the linking logic of the object libraries to a common function
The linking logic of object libraries should be reusable outside of the
resource context. This introduces a
__qt_internal_propagate_object_library function that prepares all the
necessary genexes to link and propagate the object library to the
end-point executable.

Rename resource object finalizer API to make the naming more generic
to object libraries of any kind.

Amends 5fb99e3860

Pick-to: 6.2
Task-number: QTBUG-93002
Task-number: QTBUG-94528
Change-Id: I69d0f34c0dadbd67232de91035aaa53af93d1fa1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-18 23:18:26 +02:00
Volker Hilsheimer
df31696321 macOS 11: Fix positioning of focus frame around combobox
Fixes: QTBUG-94069
Pick-to: 5.15 6.1 6.2
Change-Id: I09079726c96a41f628ae55724cfe53dbc225d358
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-06-18 22:54:15 +02:00
Alex Trotsenko
79490d2a4c QProcess/Win: avoid double buffering on write
As QWindowsPipeWriter now maintains a chunk queue, there is no need to
use the internal QIODevice buffer and wait for the previous operation
to complete.

This also allows us to get rid of the stdinWriteTrigger timer; however,
as a trade-off, QWindowsPipeWriter now needs to accept data even before
a handle is assigned.

Change-Id: I17fe0e36a6165fe05100bfab3fe01fc0d880d617
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-06-18 22:20:47 +03:00
Mårten Nordheim
bccfb92507 CMake: output VCPKG_CHAINLOAD_TOOLCHAIN_FILE with cmake paths
Change-Id: Ibde8890c30b9024aca589e892590d071b547c361
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-18 21:15:05 +02:00
Sze Howe Koh
d254af9152 Doc: Move overrideCursor() from QApplication to QGuiApplication
The transfer occurred in Qt 5

Pick-to: 5.15 6.1 6.2
Change-Id: Id3428809d89c804112d9dc02f2a476cb03bd2c98
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-06-19 02:23:15 +08:00
Tor Arne Vestbø
aeeaa7d253 Enable glyph cache workaround for Apple M-family of GPUs
Without the workaround, and when using a Core GL profile, we hit a code
path in QSGOpenGLDistanceFieldGlyphCache::resizeTexture() that produced
corrupt glyphs on M1 hardware.

We fix this by enabling the workaround, so that the user doesn't have to
set QT_ENABLE_GLYPH_CACHE_WORKAROUND themselves.

None-Core contexts do not have this problem, but the logic in
QOpenGLContext does not account for recreated contexts with different
formats, so we can't limit the workaround to Core formats only.

With the unified memory architecture of the M1 hardware, the workaround
should have limited negative effects.

In Qt 6 this is not a problem, since Qt Declarative effectively always
uses the workaround code-path, but it's worth recording the fact that
we need the workaround.

Fixes: QTBUG-89379
Pick-to: 6.2 6.1 5.15 5.12
Change-Id: Icfd8b8b23c0dcda3fea8663d81d0e225134eec5e
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-06-18 19:02:16 +02:00
Alex Trotsenko
a73ec95c1e Allow destruction of QWindowsPipeReader in its signal
As a result, we can refrain from using the deleteLater() technique in
QProcess and avoid long-lived soft leaks in blocking applications.

Change-Id: I89e02b02551a668b995ad3d12d3ce9575b2dd9dd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-06-18 17:25:43 +03:00
Laszlo Agocs
e6a969954a Do not alter a widget's backing window's format once created
Changing anything on a QWindow's QSurfaceFormat has zero and null
effects once the underlying native window has been created. Letting
QWidget update the format is wrong in this case, because we always
expect that the value returned from QWindow::format() reflects
reality.

(reality being the settings with which the underlying native resource
was created, which is typically frozen after QWindow::create(), not
the state of some QWidget attribute. There are certain exceptions to
this, such as when preparing to recreate the underlying native window,
in which case one will want to update all relevant fields of the
format based on the current values of the widget attributes, which is
exactly what QWidgetPrivate::create() implements, and that's good.)

Such a mismatch can have fatal consequences when OpenGL and friends
are involved, but this always depends heavily on the platform and
windowing system. For example, claiming that the alpha buffer size is
0 when the native window was created with 8, or vice versa, can break
OpenGL-related code (both in Qt itself and in applications), that
tries to create a QOpengGLContext configured based on what
QWindow::format() returns. If that format describes settings that are
incompatible with the actual underlying native window, we end up with
the classic Invalid pixel format, EGL_BAD_MATCH, and alike errors.

This is exactly what is happening when a QOpenGLWidget (or
QQuickWidget) is placed in a QDockWidget where one of the ancestors is
forced to native (winId() was called or WA_NativeWindow was set). When
undocking, various code paths in QWidget will try to update the opaque
flag of the widget, which in turn calls updateIsTranslucent. Now, if
this function unconditionally changes the alphaBufferSize in the
QWindow's QSurfaceFormat (even though this is completely futile to do,
it has no visible effect in practice), we get the problem described
above: rendering breaking down due to OpenGL contexts created with a
pixel format incompatible with the native window.

Prevent all this by not touching the format once the QWindow has a
QPlatformWindow. This is the right thing to do, regardless of the bug
in question: a window's (or context's or any other native resource
wrapping class's) format must describe the underlying native resource
and must never deviate, unless we are preparing to create a new native
resource underneath.

When it comes to the autotest, this changes the test added in
555661b625: the autotest logic is
inverted because what we should test for is that the QSurfaceFormat
stays untouched once the application makes a - futile - attribute
change on the widget.

Fixes: QTBUG-85714
Pick-to: 6.2 6.1
Change-Id: I7bf90711867e8a0fd474895625bf9530a7821fd5
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-06-18 15:14:02 +02:00
Alexey Edelev
29789ff0ea Use target OUTPUT_NAME as a module identifier in .pri files
QtPriHelpers copies the logic related to the module OUTPUT_NAME to
produce a module identifier. Since the module identifier should be
equal to OUTPUT_NAME it makes sense to reuse the property and
deduplicate logic.

Amends 8aee7c6b29

Pick-to: 6.2
Fixes: QTBUG-94568
Change-Id: I8d9c04273e4cdb1a2e6a3b0db3ddf52e008c0cf7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-18 15:14:02 +02:00
Giuseppe D'Angelo
f29ff5dffb Add GCC 11 and C++20 workarounds
GCC 11.1 has a bug [1] in the preprocessor that leads to
-Wsuggest-override warnings being raised in random places, even under
pragmas that are supposed to suppress it. For some reason, NOT using the
integrated preprocessor fixes it, so add that flag as a workaround.

Also, GCC 11 introduces a family of warnings for C++20's deprecations of
mixed enum arithmetic, which we use all over the place. Avoid a hard
error for those warnings.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100796

Change-Id: I3b2aefa385f191f207e7eb876bc1ed0b18fb342b
Pick-to: 6.1 6.2
Task-number: QTBUG-93360
Task-number: QTBUG-94059
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-18 15:14:02 +02:00
Eskil Abrahamsen Blomfeldt
30399fb95c Fix right-to-left text with DirectWrite engine + QPainterPath
When QPainterPath was used for RTL text, either directly or because
the target text size exceeds 64 pixels, we would pass true for
"isRightToLeft" to DirectWrite, causing it to do adaptation internally
for this. But the RTL layout had already been handled by Qt, so we
would essentially reverse the layout twice and also move the text
to negative X coordinates.

Passing false instead fixes this, as it will then just use the
positions we pass in blindly.

Fixes: QTBUG-94175
Pick-to: 5.15 6.1 6.2
Change-Id: Ie9a47e56e97fc867ede10ab21ac5e3f003ddcacb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-06-18 13:18:38 +02:00
Joerg Bornemann
7155e4f620 Remove old configure-related files
Remove the configure.json and configure.pri files that
were used for the qmake-based configure.

Remove the .prev_*.cmake files that were a by-product of
configurejson2cmake.py.

Pick-to: 6.2
Task-number: QTBUG-89536
Change-Id: Ie827562f7fd2513d59f69234d77b8b93124ea78e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-18 11:46:21 +02:00
Mårten Nordheim
ea7d87b5b5 QHash: Fix erase() edge-case
When the element you want to erase is the last element AND the
next element (element 0), when rehashed, would be relocated to the last
element, this leads to the state below. Which is similar to a test in
tst_qhash for some seeds.

auto it = hash.begin + (hash.size - 1)
it = hash.erase(it)
it != hash.end

By forcing the iterator to increment if we were erasing the last element
we always end up with a pointer which is equal to hash.end

Befriend the tst_qhash class so we can set the seed to a known-bad one

Pick-to: 6.2 6.1
Change-Id: Ie0b175003a2acb175ef5e3ab5a984e010f65d986
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-06-18 11:20:40 +02:00
Eskil Abrahamsen Blomfeldt
30f1f02cf7 codechecker: Add assert for implicit condition
Since memReq is initialized inside the loop, codechecker
complained that we might use uninitialized data if count == 0.
So we assert that this is not the case to get rid of the
warning.

Change-Id: I82152942d2bb61723e9e41489c87bfde9f8bec15
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2021-06-18 10:37:17 +02:00
Zhang Yu
e9cdcc7cb3 Fix recursion crash when calling setStyleSheet with qproperty-styleSheet
When calling `setStyleSheet` with property `qproperty-styleSheet`,
`QStyleSheetStyle::polish` will call`QStyleSheetStyle::setProperties`, and then`QStyleSheetStyle::setProperties` goes on to call `setProperty`.Because there is property `qproperty-styleSheet`, it will update stylesheet by calling QStyleSheetStyle::polish`.
This causes the recursive call to crash.

Fixes: QTBUG-94448
Pick-to: 5.15 6.2
Change-Id: I79c51192a939b0b62e5b1d0dcc90d38f79e28222
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-06-18 05:34:52 +00:00
Volker Hilsheimer
0c2ca26cd9 macOS: Resend event if the first input method event changes focus
QAbstractItemView opens the editor and changes focus in response to the
first QEvent::InputMethod event. Changing focus however cancels the
current composition, so the key press is lost and needs to be repeated by
the user. What QAbstractItemView does is probably not that unique, so
fixing this there - if possible at all - is not a general solution.

In the platform specific input method handling code, we can generally
discover that the focus object changed in response to the InputMethod
event that gets sent to the focus object. On macOS, we can then pass the
key event to the input method once more, which works fine.

On Windows and X11, the situation is more complicated. That the focus
changed is easily discovered, but re-sending the key press in such a way
that the input method responds doesn't seem possible. On Windows, using
SendInput simply delivers the exact key to the focus object, without
starting the expected composition.

On X11 with IBus, it should be possible to call ProcessKeyEvent again on
the IBus input context when we discover in filterEventFinished that the
focus object changed while delivering the event. However, any attempt to
do so has no effect.

So, for now only fixing this for macOS.

Task-number: QTBUG-54848
Change-Id: I0f7b786cfa57430e6a1e7d605415265cf53eb675
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-06-18 01:24:34 +02:00
Alexandru Croitor
b6c5e06676 CMake: Handle OPTIONAL_COMPONENTS in qt_find_package
The optional components arguments were not handled before which
caused the recorded package information for static builds to be
incorrect, it only recorded the package name without the component.

Remove REQUIRED_COMPONENTS TODO, there is no such find_package option,
it's already handled by the regular COMPONENTS code path.

Amends 07b6d3367d

Pick-to: 6.1 6.2
Fixes: QTBUG-94501
Change-Id: Ib48a7befcb70e20c3f21315897d51d3064b48134
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Dominik Holland <dominik.holland@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-17 23:28:18 +02:00
Marc Mutz
7e335f290b QWinSettings: use QScopeGuard to RegCloseKey()
RAII rulez.

Change-Id: I32bc070ae3074f782a1695bcf2079de0fc19597b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-17 20:11:15 +02:00
Fabian Kosmale
6b36e78352 QBindable: Use setter in setValue for QObjectCompatProperty
Directly writing to the underlying property storage has the potential of
breaking all kinds of internal invariants. As we return QBindable in
the public interface, we should not grant callers access to the
internals of the object.

Pick-to: 6.2 6.1
Change-Id: I737ff293b9d921b7de861da5ae23356c17690b78
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2021-06-17 19:32:56 +02:00
Alexey Edelev
8aee7c6b29 Fix internal module naming in qmake .pri files
Set the correct value to the _qt_config_module_name property at the
internal module creating step instead of appending _private suffix when
generating .pri files.

Amends 425ff34aa1

Pick-to: 6.2
Fixes: QTBUG-94568
Change-Id: I6fa8089358bc638668e313c98c3aee680bf7ec2a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-17 19:32:56 +02:00
Allan Sandfeld Jensen
d3b9759b42 Silence a few warnings from excess semicolons
We dont really need those after functions definitions.

Change-Id: I41f010a223977c55d4b7271ac3ebdc1bb9047b09
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-06-17 18:56:12 +02:00
Alexandru Croitor
5ec937115b CMake: Export info if an object lib target is a plugin initializer
Needed for qtdeclarative so we can filter out which object library
should go into which export set, because qt_internal_add_qml_module
can create both a backing library export set and a plugin export set.
The plugin initializer object lib should go to the plugin export set.

Pick-to: 6.2
Task-number: QTBUG-92933
Change-Id: I0fce131eff75a0b3090ac0fbb2a12ecfcba5e38d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-17 18:56:12 +02:00
Alexandru Croitor
a37957df5c CMake: Add TODO to apply generalized object library linking approach
Pick-to: 6.2
Change-Id: I1ea368e81d8b055ef353a0f021f188b45588c937
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-17 18:56:12 +02:00
Alexandru Croitor
602d26c38f CMake: Set the plugin class name for qml plugins
This is needed for a change in qtdeclarative to allow building the
Q_IMPORT_PLUGIN-containing object library initializer of a qml plugin.

Show an error if the qml plugin has no class name, it's needed for
plugin initialization so it's mandatory to have a class name.

Show an error if a class name is not found when computing the import
macro for a plugin (both for a regular qt plugin and a qml plugin).

When querying for the class name of a target, query both a Qt6::
prefixed target as well as a non-prefixed one, with the Qt one
taking precedence.
This is to allow querying the class name of user project created qml
plugins.

Currently regular qt user plugins don't use the object library
initializer approach. This will likely be revisited in the future.

Pick-to: 6.2
Task-number: QTBUG-92933
Change-Id: I46417471a7d8b49651e6821f7b28e7a9d44c2557
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-17 18:56:12 +02:00
Alexandru Croitor
103c1bc7ba CMake: Don't generate .pri files for qml plugins
We didn't do it in Qt 5 times and it was accidentally done for Qt 6.

There's no reason to generate them, the .pri files are only meant to
be used for regular plugins so a project can do QTPLUGINS += foo.

That mechanism is not needed for qml plugins which use
qmlimportscanner instead.

Furthermore the pri contents didn't contain a class name, so they
couldn't be used anyway.

Pick-to: 6.2
Change-Id: I6299fda21ece0f693a817ab558b45aa46b97e5ee
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-17 18:56:12 +02:00
Alexandru Croitor
15c5f90507 CMake: Remove old add_qt_gui_executable API
Repos should have migrated by now and the function should not be
advertised as a public one.

Pick-to: 6.2
Task-number: QTBUG-88763
Change-Id: Ica5bc55670a17a28c0022f78c126a3a8a8ffdeb5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-17 18:56:12 +02:00
Alexandru Croitor
51b8c81c84 CMake: Rename qt6_finalize_ios_app to be internal
For now, it's not meant to be called manually. It's called in
qt_add_executable automatically for iOS.

Amends 4d838dae5a

Pick-to: 6.2
Task-number: QTBUG-88763
Change-Id: I90dfcf86f53a3c8e48a813435f7400db232b21f4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-17 18:56:12 +02:00
Andrei Golubev
976cf0152b QList: more explicitly document capacity() shenanigans
Due to capacity() reporting the size of all allocated space, this is
somewhat inconsistent with what QVector::capacity() in Qt5 provided,
due to Q6List being double-ended. So let's document this better

Task-number: QTBUG-92941
Pick-to: 6.2
Change-Id: Iba46389121e721a8d21f0344b154f41c2c245867
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-06-17 17:44:52 +02:00
Tim Blechmann
52b2346742 gui: accessible - silence int conversion warning
msvc2019 emits:
warning C4244: 'argument': conversion from 'qsizetype' to 'int',
possible loss of data

Change-Id: I286c0d453f69654ba58f071aee28e557b9f9058d
Pick-to: 6.1 6.2
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2021-06-17 22:55:18 +08:00
Alexander Volkov
d8dbc2b95a QMimeBinaryProvider: cache comments and globPatterns
Avoid multiple re-reads of xml files, for example in dolphin,
which displays MIME type comments as file types.

Change-Id: Ia124930e2a1fdc99d8a4d160f2288a00f55e0e8e
Reviewed-by: David Faure <david.faure@kdab.com>
2021-06-17 17:36:29 +03:00
Allan Sandfeld Jensen
ada29a19cd Fix SSE4.1, RDSEED requirement for clang-cl builds
A misunderstanding seems to have caused several files to be compiled
with extra runtime arch options.

We need to disable multi-target functions though, because it doesn't
work with clang-cl headers.

Task-number: QTBUG-88081
Task-number: QTBUG-88434
Pick-to: 6.2
Change-Id: Ic5829540f9007428c80f9a7bd46af35540745ccd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-17 14:36:29 +00:00
Kai Köhne
c2c15666b7 Porting Guide: Mention that also QSet is affected by stability of references
QSet is internally implemented by a QHash. Therefore the change in
reference stability affects QSet, too.

Pick-to: 6.1 6.2
Change-Id: If1879d5a027211bca0beeff16ffbc77f2f4fce26
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-06-17 14:28:46 +02:00
Kai Köhne
b26988d0b5 Porting Guide: Mention deprecation of QLibraryInfo::location
Pick-to: 6.1 6.2
Change-Id: I998a4575ce7fb56ab51d49715071e682a440360b
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-06-17 14:28:45 +02:00
Kai Köhne
3cbe11f934 Porting Guide: Mention changed behavior of QCApplication::quit()
Mention change of behavior introduced by 89f7a2759c in the porting
documentation.

Change-Id: I3c282362f5852cc7768e6655fc7b3901d68f2b10
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-06-17 14:28:45 +02:00
Kai Köhne
88b92f76ee Doc: Remove mentioning of Qt::MidButton
It's only Qt::MiddleButton in Qt 6.

Pick-to: 6.1 6.2
Change-Id: Ia68bad910c617993e30e3ed1e117192469ec50eb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-17 14:28:45 +02:00
Eirik Aavitsland
e473d96e65 Avoid overflow in text layout
Fixes oss-fuzz issue 34597.

Fixes: QTBUG-94197
Pick-to: 6.2 6.1 5.15
Change-Id: Icabcd5a87b809b6a5ae0f1a696ec3b5dd906886b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-06-17 09:58:27 +00:00
Ulf Hermann
68b855c215 Universally pass QMetaType by value
... and add Qt7 TODOs where we can't because of BC.

Change-Id: Idce8b677ae95231e1690ac4265dc6f06818052e7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-06-17 11:58:27 +02:00
Giuseppe D'Angelo
c2839843f2 QObject: cleanup the orphaned connection lists on destruction
When a signal/slot connection is broken, it gets added to the
sender's list of "orphaned connections", to clean up later.
This cleanup happens when the sender gets destroyed or as soon as
it emits any signal.

This may cause soft memory leaks in case receivers get destroyed,
and the sender is a long living object and doesn't emit signals
for a while (e.g. QThread).

For some reason, an explicit disconnection cleans up the list
(either by using the QMetaObject::Connection object, or in case
of string-based connect, using a string-based disconnect). This
raises lots of doubts about why having this list in the first
place.

Fix the soft-leak by cleaning up the orphaned connection list when
destroying a receiver.

Note: I still believe that we shouldn't have any "orphaned"
connection list, and rather cleanup on disconnect/deletion
(otherwise, emitting a signal may cause a CPU spike because it
triggers a cleanup).  If we allow for any "impredictability" during
signal activation we're just admitting that signals/slots aren't
suitable for e.g. low-latency codepaths. That's why I'm not marking
the problem as fixed.

Original-patch-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Task-number: QTBUG-88248
Task-number: QTBUG-87774
Pick-to: 6.2 6.1 5.15
Change-Id: Id25f67a45dff49f740132a44d36e88740eb12070
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-06-17 08:56:28 +02:00
Lars Knoll
71b4d4f150 Fix crash in concurrent disconnect
This does not fix all data races that we have in the system yet.
One major issue is the virtual disconnectNotify(), that can be
called from any thread and thus is inherently problematic, as it
can collide with the object getting destroyed at the same time
in another thread.

Pick-to: 6.2 6.1 5.15
Task-number: QTBUG-88248
Change-Id: I9d841eb363b7e4f0de1657aeb8f5340d0fd55190
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-17 08:56:22 +02:00
Fabian Kosmale
556fc646cf cleanOrphanedConnectionsImpl: Allow to skip locking
This function is/will be used in a few places where we already have a
lock. Temporarily unlocking and relocking invites all kinds of troubles.
By adding a flag we can instead tell the function that we already hold
the lock.

Pick-to: 6.2 6.1 5.15
Change-Id: Ibca089de61133661d5cd75290f2a55c22c5d013c
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-06-17 08:56:17 +02:00
Fabian Kosmale
7fefce7328 QOrderedMutexLocker: Disable copy and provide explicit dismiss function
Copying a QOrderedMutexLocker is questionable, and would currenly easily
lead to UB. Therefore we delete the copy ctor and copy assignment
operator, and implement well-behaving move operators.
In addition, provide an explicit dismiss method for cases where we don't
want the locker to unlock the mutexes, as they have been manually
unlocked (this could have been implemented previoulsy by using the copy
assignment operator).

Pick-to: 6.2 6.1 5.15
Change-Id: If2a888710e1c74277b28fd3e2939ab26fff0c7ae
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-06-17 08:56:13 +02:00
Marc Mutz
259dc8cbe5 QTextStream: fix a dead write
Found by Clazy.

Change-Id: Iabe4fb23f63ea8df2142dc66cd16b04526b628c2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-17 01:33:15 +02:00
Giuseppe D'Angelo
95cb4e2260 QFileInfo: remove a couple of QFlags->int implicit conversions
Change-Id: Iabfca134709852694967d605c6a93f34a9777d8a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-17 00:53:36 +02:00
Robert Löhning
a7fa9db9b1 fuzzing: Add instructions how to reproduce issues from oss-fuzz
Change-Id: I278516f527990b3c4477436a82695e68b5f6a713
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-06-16 22:53:36 +00:00
Alexey Edelev
13a4de6bf6 Remove target specific flags from the linker capabilities check
Remove target specific flags from static_link_order.
Move the check to the common config.tests folder.

Amends 5fb99e3860

Pick-to: 6.2
Task-number: QTBUG-93002
Task-number: QTBUG-94528
Change-Id: I1368075ec6bd1e743b2b89fd93143df38a278ec2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-16 21:56:09 +02:00
Alexandru Croitor
335123f240 CMake: Don't make example external projects depend on tests
Only depend on the ${project}_src and ${project}_tools targets.

This might exclude some non-obivous target dependencies, but we can
adjust that if needed.

This reduces the build.ninja file of qtbase + qtsvg form 341MB
to 41MB when configuring with tests and examples, as well as reduces
the processing time of calling ninja.

Amends d97fd7af2b

Pick-to: 6.2
Change-Id: I2860d8ae89728f33f6b73fede1335cd6d6290f78
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-06-16 20:01:30 +02:00
Alexandru Croitor
906c84a9a3 CMake: Mention resource name on which rcc is run
Pick-to: 6.2
Change-Id: I12189d7bf3fbe8544ae4c3478166515ea2759bec
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-16 20:01:30 +02:00
Alexandru Croitor
9297459900 CMake: Change some custom commands to mention the target name
Pick-to: 6.2
Change-Id: I3a198c87ba2d71306478809095083694b65c7086
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-16 19:56:46 +02:00
Edward Welbourne
cc64959602 Tidy up tst_QString::localeAwareCompare()
It was suppressed unconditionally (albeit in different places and with
different levels of obviousness) almost everywhere, due to inability
to set the system locale in use by the implementation. Several
test-cases used ISO-8859-1 encoding on Q_OS_MAC, where the tests were
all suppressed anyway. A block of no_NO tests was #if 0'd out; and
should, in any case, have been nb_NO. Tests of any locale but en_US
were skipped on Q_OS_WIN because we can't set the locale (but
including the tests of en_US tacitly assumed that's the system
locale). If setlocale() failed, for ICU or DARWIN, the test was
skipped; but we might as well check for this in the _data() to save
repetition.

The test was laboriously going through the sign cases; relocate the
QString::compare() test's sign() function so that we can use it here,
too, and simply QCOMPARE() signs. Introduce a TransientLocale class,
copied from tst_QLocale, to take care of setting and restoring the
locale using setlocale(). Change the locale name to a QByteArray so
that we save having to convert it to one in order to pass it to
setlocale(). Since that changed every _data() row, reformat those rows
in the process - most of them were long lines.

On the systems where we can't set the locale used by the function
being tested, condition each block of tests in the _data() on whether
LC_COLLATE looks like the locale to be tested, and report how a
determined developer at least can (by repeatedly running the test with
different locales set) test all the cases; and we'll attempt the ones
that we can, when one of the relevant locales is in use. If that
leaves us with no tests we can do, QSKIP() in the _data() to avoid an
assert failure for "Test data requested, but no testdata available."

Change-Id: I75709fda8827dcbe74f80c4136042054da6fcb13
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-16 17:42:37 +02:00