Commit Graph

13022 Commits

Author SHA1 Message Date
Thiago Macieira
5e67e7efaa FatalSignalHandler: print some more information from siginfo_t
The siginfo_t parameter allows us to show what process sent a signal or
the crashing address. Additionally, it allows us to determine if the
crashing signal was indeed sent due to a crash.

The selftest tst_crashes produces now:

$ QTEST_DISABLE_STACK_DUMP=1 ./crashes
********* Start testing of tst_Crashes *********
Config: Using QtTest library 6.4.0, Qt 6.4.0 (x86_64-little_endian-lp64 shared (dynamic) debug build; by GCC 11.2.1 20220420 [revision 691af15031e00227ba6d5935c1d737026cda4129]), opensuse-tumbleweed 20220428
PASS   : tst_Crashes::initTestCase()
Received signal 11 (SIGSEGV), code 1, for address 0x0000000000000004
         Function time: 0ms, total time: 0ms
[1]    201995 segmentation fault (core dumped)  QTEST_DISABLE_STACK_DUMP=1 ./crashes

The last line comes from the shell. The code isn't decoded, but on Linux
it's a SEGV_MAPERR. macOS prints exactly the same thing.

I've updated one of the expected_crashes_*.txt output that doesn't seem
possible (the "Received a fatal error" message does not appear in Qt
anywhere).

Pick-to: 6.4
Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16ebc8391234f0e2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-28 00:39:35 +00:00
Laszlo Papp
9521a07af2 QKeySequenceEdit: add a maximumSquenceLength property
At the very least, it would be important to have a single combination
key sequence. This is commonly seen in keyboard shortcut editors where
QKeySequenceEdit is very much applicable.

[ChangeLog][QtWidgets][QKeySequenceEdit] Added a maximumSquenceLength
property.

Done-with: Marc Mutz <marc.mutz@qt.io>
Change-Id: Id7fa5a8593eb150fa67d7e89308492c0a200ac36
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-06-27 12:02:47 +00:00
Mårten Nordheim
4d60ba61dc Fix QDBusInterface crashing with empty path on construction
On some machines having an empty path passed to QDBusInterface
would cause a crash.

This happened because the code created a QDBusMessage and manually
marked it as validated when it was not. The validation would not
pass for this object.

Change-Id: I496dd922fa64353399655a1e84996b99990f5879
Pick-to: 6.4 6.3 6.2 5.15
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-27 14:02:47 +02:00
Lars Schmertmann
e3ea1d02e6 QHttpHeaderParser: Allow larger fields but restrict total size
Our limit of 8k for a single header field was too small for certain
services which returned Location values or WWW-Authenticate challenges
longer than 8k.

Instead, taking inspiration from Chromium, we have a limit of 250k for
the full header itself. And increasing our field limit to 100k, which
would occupy almost half of what the total header allows.

Also took the opportunity to make it adjustable from the outside so we
can set more strict limits in other components.

Fixes: QTBUG-104132
Pick-to: 6.3 6.4
Change-Id: Ibbe139445e79baaef30829cfbc9a59f884e96293
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2022-06-27 14:02:47 +02:00
Thiago Macieira
f5697d2b2a tst_moc: fix build with GCC 12
You can't mismatch the export macros. The QT_MOC_EXPORT_PLUGIN_V2 macro
defines these functions as Q_DECL_EXPORT so they can be found by
QPluginLoader. We must match the macro here, otherwise GCC 12 complains
(tst_moc.cpp is compiled with -fvisibility=hidden):

tst_moc.cpp.o: non-canonical reference to canonical protected function `qt_plugin_instance' in moc_plugin_metadata.cpp.o

Pick-to: 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16f99893d5730da5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-24 19:05:53 -07:00
Shawn Rutledge
846b314aaf Emit autolinks in QTextMarkdownWriter
When a markdown document contains a "naked" URL, or an angle-bracketed
<URL>, md4c recognizes it, and we set the AnchorHref charfmt property.
There's no need to expand it into the [text](url) form if the text is
the same as the url, there is no tooltip, and the url is valid.
QTextMarkdownWriter now writes a CommonMark "autolink" in that case:
https://spec.commonmark.org/0.30/#autolinks

[ChangeLog][QtGui][Text] QTextMarkdownWriter now writes an autolink
whenever a hyperlink has no custom text and no tooltip, including
when the document was parsed from Markdown containing a naked URL.

Pick-to: 6.4
Fixes: QTBUG-94713
Change-Id: I432db8499c62e1e0b1e913bfd8ef2147e3c2bb2a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-06-24 22:42:43 +02:00
Shawn Rutledge
56f0ebfe86 Support markdown in QTextEditMimeData; fix pasting trailing newlines
- Since 4edcea762d the dropsite example
  shows markdown if available; and now it shows that when we do DnD
  of a selection from the richtext example, text/markdown is available.
- If we artificially make html unavailable, copying and pasting between
  widget-based rich text editors uses markdown.

In case markdown writer output contains unnecessary backticks due to
monospace fonts getting used, the workaround from
1ad456c908 is applied.

Pick-to: 6.4
Task-number: QTBUG-76105
Task-number: QTBUG-103484
Change-Id: Ie6ca4dbb450dbc36b3d09fd0df1ae5909aaebca7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-06-24 22:42:28 +02:00
Toni Saario
ec0ecedf2a Blacklist qtcpsocket bind on arm macOS
This was unblacklisted in b885820c39
however it is still very flaky.

Change-Id: If9796231c584c894387106dfeb262c9eb4ce73f5
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-06-24 17:20:02 +00:00
Mårten Nordheim
6cbe8f74ce Network: Update expired cert
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I233ffee5b720c0554071c1d49d4fb861736b2e2a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-06-24 17:20:00 +00:00
Anna Wojciechowska
b885820c39 unblacklist passing tests 2022
Change-Id: Ifb09a997d39fc2c92503e77cf372d443c13c4c2b
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2022-06-23 01:36:01 +02:00
Thiago Macieira
dda9c9e2bc moc: fix use of escape sequence of more than one character
We had the code to calculate the length, but were improperly using it
only for the offset, not the length of the string or its containing
array. That resulted in the generated moc output containing:

 QT_MOC_LITERAL(111, 5), // "\xffz"
 QT_MOC_LITERAL(114, 5), // "\0012"
 QT_MOC_LITERAL(117, 23), // "slotWithAReallyLongName"

The two strings are described as occupying 5 bytes (length 4 + null
terminator), which is incorrect. The offset was correct: 114 - 111 = 3
and 117 - 114 = 3. The new output is:

        QT_MOC_LITERAL(111, 2),  // "\xffz"
        QT_MOC_LITERAL(114, 2),  // "\0012"
        QT_MOC_LITERAL(117, 23),  // "slotWithAReallyLongName"

The effect of the array size calculation would only be felt if moc
decided it needed a second string array (for strings over 65535 bytes),
which would cause the offsets in the second array to be all wrong. There
was no such test until now.

Drive-by fixing of the newline, indentation, and the stale comment
referring to QByteArrayData (Qt 5).

Pick-to: 6.2 6.3 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16f9cd01b3e0709a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-22 13:03:17 -07:00
Ye ShanShan
c3b959733a Add QDom internalSubset implementation
QDom's internalSubset() always returned empty because nothing
actually set the internal data member it returns. When parsing
the DECLTYPE, extract the internal subset and save it to the
doctype()'s member when present.

Pick-to: 5.15 6.2 6.3 6.4
Fixes: QTBUG-53661
Change-Id: I6e41ff8b914381168246073b3289d82205b1c255
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-06-23 02:18:39 +08:00
Ulf Hermann
2c0518eb62 moc: Allow reading property values through bindables
The behavior is similar to MEMBER: If the READ accessor is "default",
synthesize it using the bindable.

[ChangeLog][QtCore] You can now specify "READ default" in a Q_PROPERTY
if you also specify a BINDABLE. moc will synthesize a READ accessor in
that case.

Task-number: QTBUG-97249
Change-Id: I4a275adabaed12df95dac505095f847c4be65dfe
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-22 16:05:07 +02:00
Thiago Macieira
e114fec62a QJsonValue: fix incorrect to{Array,Object} when the value is empty
This is a repeat of commit de6ced6692
"QCborValue: fix incorrect to{Array,Map} when the value is empty" (6.4),
which fixed the same thing for QCborValue. I've just copied the exact
same implementation onto the QJsonValue functions.

Pick-to: 6.2 6.3 6.4 5.15
Fixes: QTBUG-104085
Change-Id: I175efddd75f24ae59057fffd16f6b257bf7ed36d
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-06-21 22:25:32 -07:00
Sona Kurazyan
bf3fc5c95c QPromise: run continuation(s) on destruction
If the QFuture is canceled because the associated QPromise has been
destroyed, we still need to run its continuations (i.e. onCanceled
handler, if it's attached), so replaced the cleanContinuation() call
inside ~QPromise() with runContinuation(), which will also take care of
cleaning the continuation.

[ChangeLog][QtCore][Important Behavior Changes] QFuture now runs its
continuations when its associated QPromise has been destroyed.
Previously, if a QFuture was canceled because the associated QPromise
has been destroyed, its continuations were skipped.

Fixes: QTBUG-103992
Pick-to: 6.4 6.3 6.2
Change-Id: Ie05bc760c96c349aade8adb8d2fe5263aff8efac
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-22 03:09:24 +02:00
Shawn Rutledge
579f0a4cf2 Remove unused variable in tst_QTextEdit::setDocumentPreservesPalette()
Change-Id: I96c0f39c2ee1bd03cf0d7939624652ee008c9726
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-06-21 21:42:18 +02:00
Lars Knoll
9c1f3b6d4d Add QStringDecoder::decoderForHtml()
Now that QStringConverter can handle non UTF encodings through ICU,
add a way to get a decoder for arbitrary HTML code.

Opposed to QStringConverter::encodingForHtml(), this method will
try to create a valid string decoder also for non unicode codecs.

Pick-to: 6.4
Change-Id: I343584da1b114396c744f482d9b433c9cedcc511
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-21 01:04:12 +02:00
Sona Kurazyan
da0d7f61c8 QDom: Stop treating non-BMP characters as invalid
According to https://www.w3.org/TR/REC-xml/#NT-Char unicode characters
within the range of [#x10000-#x10FFFF] are considered to be valid, so
fix the check for valid characters accordingly. This requires changing
the loop over the input QString to iterate over code points (instead of
code units).

Fixes: QTBUG-104362
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I7dcf5cad05265a54882807a50522d28b647e06ee
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-20 21:29:04 +00:00
Mårten Nordheim
3d73aa660b function_ref test: Don't take reference of temporaries
When assigning the lambdas directly to a function_ref their lifetime is
limited to that of the expression. Store them on the stack first to
avoid the UB.

Fixes: QTBUG-104419
Pick-to: 6.4
Change-Id: I3c85ac683b0bd7768b646dc9d0a1ed4dd173e6f3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-20 19:52:01 +00:00
Volker Hilsheimer
2e12479e06 QGraphicsScene: respect that items can override selection changes
QGraphicsItems may override itemChange to prevent certain attribute
changes. Overriding ItemSelectedChange this way is explicitly documented
to be allowed.

However QGraphicsScene::clearSelection did not test whether items were
in fact deselected after the call to setSelection, and always cleared
the stored set of selected items.

Fix this by checking the actual selected state of the item as we iterate
over them, and store those items that are still selected in a set that
becomes the new selectedItems set (which will be empty if no item
overrides, which is the default).

Add a test that also checks that clearing the selection emits the
selectionChanged signal correctly (and does not if all selected items
block being deselected).

Fixes: QTBUG-85474
Pick-to: 6.4 6.3 6.2
Change-Id: I665afc132876e02e6e1061b7be37f4f6e4be418f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-06-20 20:44:23 +02:00
Heikki Halmet
bb674adb25 BLACKLIST tst_qfont for Ubuntu 22.04
Pick-to: 6.4 6.3 6.2 5.15
Task-number: QTBUG-84248
Change-Id: I2978cd2a6ed07bb6fc5769b174d0a897dfa3566d
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2022-06-20 17:06:20 +00:00
Allan Sandfeld Jensen
0bd2876275 Avoid misleading bindingStatus
Set it to nullptr on clear, and deal with possibly null bindingStatus.

Task-number: QTBUG-101177
Task-number: QTBUG-102403
Pick-to: 6.4
Change-Id: I66cb4d505a4f7b377dc90b45ac13834fca19d399
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-06-20 19:06:20 +02:00
Heikki Halmet
903bde19a4 BLACKLIST: tst_QGlyphRun::mixedScripts for Ubuntu 22.04
Pick-to: 6.4 6.3 6.2 5.15
Task-number: QTBUG-68860
Change-Id: I79c085c7321e0bee78e8cb31daa8c7992d3a3ec6
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2022-06-20 20:06:20 +03:00
Heikki Halmet
a3c43394bb BLACKLIST tst_QApplication::sendEventsOnProcessEvents for Ubuntu 22.04
Pick-to: 6.4 6.3 6.2 5.15
Task-number: QTBUG-87137
Change-Id: Ib09382af7504f5ee078d23cc021c1b0faf051e23
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2022-06-20 20:06:20 +03:00
Heikki Halmet
5aca1fe1d0 BLACKLIST tst_QMenuBar::check_menuPosition for Ubuntu 22.04
Pick-to: 6.4 6.3 6.2 5.15
Task-number: QTBUG-68865
Change-Id: I1eda9789a30737104c6e97de583a9f3022ae0bf6
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2022-06-20 20:06:20 +03:00
Fabian Kosmale
c15714191c tst_qthread: Fix compilation under ubsan
We missed the terminating ";" in the QSKIP lines.
Amends ea4d6b987a

Pick-to: 6.3 6.4
Change-Id: Ibda43b8a84230c243dbcc74e157f4c3f8ef3891d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-20 12:12:07 +02:00
Volker Hilsheimer
ea4d6b987a Skip tests that terminate threads under ASAN
Thread termination might prevent stack unwinding, which then
generates ASAN errors such as

ERROR: AddressSanitizer: stack-buffer-underflow on address
0x7f3c1d7858b0 at pc 0x7f3c243d8918 bp 0x7f3c1d7857f0 sp 0x7f3c1d7857e8

Skip such tests so that we can enable blocking CI runs under ASAN.

Fixes: QTBUG-104421
Pick-to: 6.4 6.3
Change-Id: I169235a12190e3f72525cddfe1a44a4bee19eca1
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-06-19 12:16:00 +02:00
Fabian Kosmale
122270d6be Long live the ICU-based QStringConverter interface!
This adds support for additional codecs to QStringConverter when ICU is
available.

We store the converter in the state (d[0]), and its canonical name in
d[1]. We need the name there, as in the clear function we close the
UConverter, and set the pointer to null. Consequently, the actual
conversion functions might need to re-open the converter again. The
advantage of this approach is that clear is used in the destructor of
State, and with this approach we properly clean up the state.
There is however a disadvantage: The clear function was so far also used
for resetting the state when QStringConverter::resetState . Discarding
the whole Uconverter for that is however rather costly. For that reason
we modify resetState to call a new function, State::reset. For existing
converters, it behaves the same as clear; for the ICU based converter,
we call the more efficient ucnv_reset. Code compiled against Qt 6.4 can
benefit from this more efficient version; code compiled against older Qt
versions will continue to work, as the conversion functions can just
recretate the converter from the name.
We can distinguish between ICU and non-ICU converters by checking if the
UsesIcu flag is set.

QStringConverter::name is changed to return the name stored in d[1]. The
interface of the ICU converter has a dummy name, so code using the old
name function from QT < 6.4 still returns something, namely a message
asking the user to recompile.
The function is moved out of line, as we need to check for the private
ICU feature, and want to avoid having that check in the public header.

As the QStringConverter ctor taking a name now can allocate memory, it
can no longer be noexcept. Removing the noexceptness is safe, as it was
only added after Qt 6.3.

Note that we cannot extend the API consuming or returning Encoding, as
we use Encoding values to index into an array of converter interfaces in
inline API.

Further API to support getting an ICU converter for HTML will be added
in a future commit.

Currently, the code depending on ICU is enabled at compile time if ICU
is found. However, in the future it could be moved into a plugin to
avoid a hard dependency on ICU in Core.

[ChangeLog][Corelib][Text] QStringConverter and API using it now
supports more text codecs if Qt is compiled with ICU support.

Fixes: QTBUG-103375
Change-Id: I7afb92fc68ef994179ebc7a3aa73beebb1386204
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-19 00:41:12 +02:00
Axel Spoerl
99c8ffb9f2 Update window state in QWindowsWindow and QXcbWindow geometry setters
When QWidget::resize() is called on a maximized or minimized QWidget,
the window state of the widget and the corresponding QWindow is not
updated (i.e. remains maximized or minimized).

This patch updates the window state to Qt:WindowNoState when
setGeometry() is called in QWindowsWindow or QXcbWindow.

A test is added in tst_QWidget.

Fixes: QTBUG-104201
Pick-to: 6.4
Change-Id: I07491fb9293d13509573fc403750da0a50f6a785
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-17 18:59:22 +00:00
Ivan Solovev
2ed54dedf3 QMainWindow: fix restoreState() for toolbars
Restoring the toolbar state of a QMainWindow could not update
QWidgetPrivate::widgetItem for the QToolBar, because at that point it
was still holding the pointer to the widgetItem of the previous state.
Later on, when the new state was successfully applied, the previous
state was deleted, and the corresponding widgetItem was reset to
nullptr.

This patch explicitly resets the QToolBar's widgetItem while updating
the state, so that it is later correctly updated while creating a
new QWidgetItemV2.

Fixes: QTBUG-102395
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I17613d62423edcc0faf85ecb0a714865a50d87e8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-17 20:59:21 +02:00
Edward Welbourne
cfcbf38f76 Teach qmake about digit-grouping apostrophes in numeric literals
It was previously understanding them as character literal delimiters,
with unfortunate consequences if a numeric literal contained an odd
number of them. Recognize that an apostrophe with a digit on each side
of it isn't the opening quote of a character literal (unless the digit
before it is preceded by a u). Extend the findMocs test to trigger the
bug, prior to the fix; verified it passes with the fix.

Fixes: QTBUG-98845
Change-Id: I5db3ac59aaeade7c2d6c1fb680ba97261ec0e8a9
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-06-17 00:05:53 +02:00
Ivan Solovev
662184ac68 QComboBox: emit currentIndexChanged() and currentTextChanged() when the model is cleared
QComboBox uses QPersistentModelIndex to store the current index of the
underlying model. When the model is cleared, that index is automatically
invalidated, so calling QComboBoxPrivate::setCurrentIndex(QModelIndex())
does not result in signals being emitted, because we do not detect the
index change.

This patch uses indexBeforeChange to detect such situation and emit all
necessary signals.

Fixes: QTBUG-103007
Pick-to: 6.4 6.3 6.2
Change-Id: I29326830a30a17900839e8d1737a08bd940081ea
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-16 19:29:36 +02:00
Laszlo Agocs
e4961afed2 Work around lavapipe bug in tst_qvulkan
Work around https://gitlab.freedesktop.org/mesa/mesa/-/issues/5875 by
treating the driver as broken when both the driver and device UUIDs
are all zeroes.

Fixes: QTBUG-104231
Pick-to: 6.4 6.3 6.2
Change-Id: Ibf7973361d472ebb1cb433bc61b50b2828f75c6b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-06-16 17:29:36 +00:00
Volker Hilsheimer
79a11470f3 Accessibility: don't emit focus change when reason is window activation
If a window becomes active, then the accessibility system gets informed
about that already. Qt puts focus on the focus child of the activated
window afterwards, and if this emits another accessibility event, then
accessibility clients like Windows Narrator will stop reading the
activated window, and instead read about the focused widget.

This makes dialogs like message boxes poorly accessible.

Accessibility clients already know that a window became active, and can
query Qt about the focused child within that window.

Amend test case.

Fixes: QTBUG-101585
Pick-to: 6.4 6.3 6.2
Change-Id: I2d6bff7c415a6f29c4a4f7f4e4be38079fb976ca
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2022-06-16 19:29:36 +02:00
Volker Hilsheimer
56d6a36020 Implement a dedicated QAccessibleInterface for QMessageBox
QMessageBox has text values that an accessible client should be able to
read directly without having to navigate through the text labels.

Add test coverage.

Windows Narrator is inconsistent in reading the contents of a message
box. It might skip them completely, even though the text property is
read through the interface.

Task-number: QTBUG-101585
Change-Id: I639c2210a627733c093743790c6a6b83f4bb80d0
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2022-06-16 19:29:36 +02:00
Ulf Hermann
4912903e37 Endian: Remove old special integer bitfields
The only way to use them was to put them in a union and then write all
the members of the union to set the various bit ranges. As only one
member of a union can be active at any time, the compiler is free to
optimize those writes away, though. This has started happening in the
wild now.

As we have a replacement, we can remove the old and broken code now.

Task-number: QTBUG-99545
Change-Id: I90718ec06662258d1c15220f54da9eed2186c5a5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-16 06:12:27 +00:00
Thiago Macieira
2a1122f465 QStringConverter: fix use-after-free in the stack in the test
Detected by ASan. Introduced by aef27c5aa2

Pick-to: 6.3 6.4
Fixes: QTBUG-104261
Change-Id: Id0fb9ab0089845ee8843fffd16f88bdeb4f42c7c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-06-15 15:43:32 -07:00
Dimitrios Apostolou
96001cb812 Increase timeout of slow test for ASAN-enabled build
Change-Id: I47b6e7e1462c1af7d41677bfe7bb0f78430f72d1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-15 23:58:16 +02:00
Dimitrios Apostolou
f0c0ec59df Fix memory leaks
This renders these simple tests ASAN and LSAN (Address Sanitizer
and Leak Sanitizer) clean.

Change-Id: Ibe5b7054a20c1575a1a7939b0bed4101afeeee56
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-06-15 23:58:16 +02:00
Dimitrios Apostolou
741fc8b752 Increase timeout of slow test for ASAN-enabled build
Change-Id: Iea0802220701501f18822a5eb1f1b0c22f62e705
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-15 23:58:16 +02:00
Kai Köhne
9d2cc4dd76 Fix typos in docs and comments
Found by codespell

Pick-to: 6.4
Change-Id: Ie3e301a23830c773a2e9aff487c702a223d246eb
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-06-15 21:31:02 +02:00
Laszlo Agocs
9dced35b41 Use consistent ordering in QShader
Fixes: QTBUG-101923
Change-Id: I62df3eba773350e47ed650acb00bc42b3ce6a899
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-06-14 14:58:09 +02:00
Marc Mutz
fa4d18b86c Revert "qxp::function_ref: drop use of q23::invoke_r"
This reverts commit b9cce12e76, which
broke

    function_ref<void(int)> f = [](int i) { return i; };

ie. swallowing of return types.

We could maybe implement the same without invoke_r, with the same
manual if-constexpr that invoke_r has, but it would be a pointless
duplication across the two thunks we have, so just use invoke_r.

Add tests.

Pick-to: 6.4
Task-number: QTBUG-103739
Change-Id: I6034f05d813c06a25e8058ded5b6b62f3ca858b4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-14 01:30:48 +00:00
Marc Mutz
6345929115 tst_QResourceManager: extend the test to cover open files
... when unregistering.

Task-number: QTBUG-86088
Change-Id: I11112142ef1d8c4b269089a0a82ca06a5e434f7e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-06-14 03:30:48 +02:00
Marc Mutz
1b8b802455 tst_QAnyStringView: explicitly check the spaceship operator
We implicitly checked it, because, in C++20 builds, the non-equality
relational operators are synthesized from it by the compiler, and we
test those, but we didn't check that <=> returns strong_ordering.

We now do.

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-104108
Change-Id: Ieb19a2d4cb2d600d884f4e2e89e98c6187e23872
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-06-14 01:30:48 +00:00
Volker Hilsheimer
ac80cee846 Don't crash when removing the last visible tab
The code incorrectly tried to ensure that the firstVisible tab was a
valid index, even though there might not be any visible tab left after
removing the last visible tab.

The same logic didn't exist of the lastVisible tab, so we tripped the
assert in qBound, as max (being -1) ended up smaller than min (0).

Fix this by removing the wrong correcting of firstVisible to be always
valid. Make sure we emit currentChanged with -1 when no visible tab is
left after removing the current tab.

Add a test.

Fixes: QTBUG-104003
Pick-to: 6.3 6.2
Change-Id: I27e6438a02d0a0f1ac4d0e0160cee4f33b3f3766
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-06-13 14:04:31 +02:00
Jan Arve Sæther
e7477e8934 Update window geometry when QWindow::m{in|ax}imumSize is updated
More specifically, if either minimum or maximum size are updated, make
sure that the current window geometry is updated so that it is within
the minimum and maximum sizes.

Previously, these constraints was only respected by the window manager
when the user resized the window.

For widgets this already worked, because a top-level widget will take
care of respecting these constraints if they are changed.

Since QWindow::setMinimumSize and QWindow::setMaximumSize started to
share so many common things, a new function (setMinOrMaxSize_helper())
is added.

Task-number: QTBUG-102771
Change-Id: Ia4b2680dcf865f84a3cf6424187f9a6036b76386
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-06-13 09:19:17 +02:00
Shawn Rutledge
eee9d25202 Use CSS classes on html list items for checkbox support
If we replace the bullet character with a UC checkbox character, it
looks ok in a browser, and the HTML parser can recover the BlockMarker
attribute from the css class.

[ChangeLog][QtGui][Text] Checkbox list items can now be read and written
in both HTML and Markdown, including conversions.

Task-number: QTBUG-103714
Change-Id: Ic6b74512075cd4ac16d6f80fdf55b221447491a9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-06-11 14:18:35 +00:00
Laszlo Papp
0a78cb7fab QNetworkReply: Fix the test compilation
It would not compile on my Linux box due to using QVariantMap, but not
actually including QMap itself. Using gcc 9.3.1 on CentOS 7.

Pick-to: 6.3 6.4
Change-Id: I808a270c814a906030cb34b197d3a2a85ba384e1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
2022-06-10 20:57:19 +00:00
Vladimir Belyavsky
865212057b Windows: fix DeferredDelete events processing on QThread::terminate()
On finishing/terminating a thread, when processing posted events,
we need to consider QThread's own data instead of caller thread's data.
Otherwise we can get into unexpected situations such as double
destruction of an object, premature destruction, etc.

Fixes: QTBUG-103922
Pick-to: 6.4 6.3 6.3.1 6.2 5.15
Change-Id: Idf77221ebbaa0b150ee2d0c296b51829ae8dc30e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-10 19:40:32 +00:00