The constructors didn't initialize all fields, leading the
compiler-generated move contructor to read invalid enum values:
Says UBSan:
tst_qmainwindow.cpp:1645:8: runtime error: load of value 32675, which is not a valid value for type 'Orientation'
#0 0x55b1bd283e2e in AddDockWidget::AddDockWidget(AddDockWidget&&) tst_qmainwindow.cpp:1645
[...]
tst_qmainwindow.cpp:1645:8: runtime error: load of value 72, which is not a valid value for type 'DockWidgetArea'
#0 0x55b1bd284024 in AddDockWidget::AddDockWidget(AddDockWidget&&) tst_qmainwindow.cpp:1645
[...]
(ubsan does not direct uninitialized memory accesses directly).
Fix by vale-initalizing the two members. This is the most natural
initialization for these members: Given that the test passed even with
random data before, 0 is surely good enough.
Amends the start of the public history.
Pick-to: 6.8 6.5 5.15
Change-Id: I6fc0b2f79679fd0f69024066c1e66b4434a5ebe6
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit af71de2036)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The test function contains two completely separate tests: The old
setFloating() method from a910daf52678469b7e595da5fe54aa09ba2373c3^,
and the additions of said commit, which don't reuse any objects of the
old function.
Turn the latter into a new test function, setFloatingReparenting(), to
help code readers understand that these two parts of the test function
have nothing in common.
Case in point: setFloating() is now ubsan+asan-clean while
setFloatingReparenting() inherits both asan and ubsan errors of the
old, combined function.
Amends a910daf526.
Pick-to: 6.8 6.5
Change-Id: Ib0d54d47e74d4c3b70637bef95fa81d4da83dd76
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit b724c3708b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The RegisterWindow request expects a window id. The QDBusMenuBar uses
the QWindow::winId() property for that. On X11, the winId() returns
the XID of the window. On Wayland, the winId() returns an integer that
has meaning only to the application, there are no global window ids on
Wayland. The menubar should be registered using other means, for
example using the kde-appmenu protocol, which QtWayland already does.
The QDBusMenuBar can skip synchronously calling the RegisterWindow
request on Wayland because the menu will be registered using a different
api.
Change-Id: I6b2968624c5c9ddbdc93807f65eac369dc7a993a
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit fa1fab994e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Using MSVC 19.43 in C++20 mode leads to a compile error in
tst_qstringview. MSVC interprets QStringTokenizer as
std::ranges::sized_range because it found size() in the namespace
QtPrivate::Tok. QStringTokenizer is derived from a class in that
namespace.
Naturally this leads to a compile error because QStringTokenizer has no
size member function as required in QtPrivate::Tok::size():
qstringtokenizer.h(118): error C2039: 'size': is not a member of
'QStringTokenizer<QStringView,QStringView>'
qstringtokenizer.h(232): note: see declaration of
'QStringTokenizer<QStringView,QStringView>'
qstringtokenizer.h(118): note: the template instantiation context
(the oldest one first) is
tst_qstringview.cpp(680): note: see reference to function template
instantiation ...
The problem can be avoided by renaming QtPrivate::Tok::size() to
tokenSize. MSVC 19.43 interprets QStringTokenizer as std::ranges::range
that do not need the size() member function.
Pick-to: 6.8
Change-Id: Ib94db8e4d840a143bbf693c89e3714e1528a0267
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit eabbc15a5b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The bootstrap lib doesn't build qfilesystemengine_mac.mm, and that's
where QFileSystemEngine::supportsMoveFileToTrash and
QFileSystemEngine::moveFileToTrash are implemented.
Make sure that the preprocessor picks up the QT_BOOTSTRAPPED condition
first to define implementations for the two methods.
Fixes: QTBUG-135650
Change-Id: Icf7995abfae368b9f5bd5c4ccfcf4c3c6664d519
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fc277e3ff6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The combination of
-no-feature-evdev
-no-feature-tslib
-no-feature-libinput
led to the creation of the InputSupportPrivate module without source
files.
This triggered CMake upstream issue 23464 when using CMake < 3.25.
Fix this by adjusting the inexact condition that decides whether to
build InputSupportPrivate.
Pick-to: 6.8
Fixes: QTBUG-99957
Change-Id: If23d029f21811b6ff7c92ac9ecd2882aedb309d6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit cf2efa90fa)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
We have our own implementation of the atomics API in Harfbuzz
for broader platform support. This is done through the mechanism
in Harfbuzz where you make a file called config.h with the
implementation and then define HAVE_CONFIG_H.
In Qt, we have this in src/3rdparty/harfbuzz-ng/config.h,
next to the CMakeLists.txt.
However, on some platforms, a different config.h has been found
earlier in the include paths and included instead, causing us to
use the default atomic implementation instead on these platforms.
This causes problems with the upgrade to Harfbuzz 11, where the
atomics have been written to depend on some template syntax which
is not properly supported on the Integrity OS compilers yet.
This was also a random inconsistency, so rather than try to work
around the compile issue on Integrity, we add the CMakeLists.txt
directory as the first include path, to make sure the correct
config.h is picked up on all platforms.
Pick-to: 6.8 6.5
Change-Id: I5fc2d57e740ea0a59700ebe319213fe716f8490e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 66fae045cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
To follow the system we map key events that include ⌘ as if they had
been made using a Latin/Roman keyboard layout. However when looking
for the ⌘-keymap, we were not taking Qt::AA_MacDontSwapCtrlAndMeta
into account, and since the keymap differs whether the attribute is
set or not we ended up pulling the Meta-keymap instead.
Fixes: QTBUG-133963
Pick-to: 6.8
Change-Id: I32dd06025e1e1d93f3792952e6ad842efc6245a6
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 2e5a881d34)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This does mean that if a custom stack size has been requested which
is larger than the default size, we'll end up with a custom stack
on the heap instead of on the existing stack.
I don't remember exactly why we opted for our custom stack to live
on the stack in the fist place. The commit message for the change
that introduced it (59601e06d9) does
mention garbage collection as once use-case, but iOS hasn't used
GC itself, and a GC's mark-and-sweep would have to include the heap
in any case.
However, for compatibility we keep the custom stack on the stack
if we can, as we pass the default stack size to QVarLengthArray,
which covers 99,9999% of apps use anyways (GitHub shows no hits
for the QtRunLoopIntegrationStackSize override that would trigger
a heap-allocated custom stack).
In testing on both simulator and device a custom stack size that
results in a heap-allocated custom stack does work, so we should
be good in either case.
Fixes: QTBUG-135609
Pick-to: 6.8
Change-Id: I86251da005ebca8a1cad5cabd2835e83486b3f8e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit be93c06758)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
When the radiobutton/checkbox has no text, the size is to small as the
check rect is enlarged by 2px due to the rounded borders. This is only
visible when they have no text as otherwise there is enough space
between the checkbox and the text.
Therefore add 2px in width when no text is available.
Pick-to: 6.8
Fixes: QTBUG-135628
Task-number: QTBUG-133117
Change-Id: I8e3342fdc980485ab1494ef7f6df044f42883619
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
(cherry picked from commit 696f9adaa4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
QDoc generates warnings for images that do not have alt-text associated
with them. Alt-text is used to add context to images for users who use
screen-readers.
This patch applies alt-text to images in the Qt SQL module that do not
have any alt-text associated with them.
Fixes: QTBUG-135114
Pick-to: 6.8
Change-Id: Iead375852d30219db7dfed12bb1f383eb55713e6
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 7b66c906bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
source_group is used by various IDEs, including Qt Creator,
so it makes sense to do that for other generators too.
Amends 06ea3e3994
Change-Id: I32334d658ea5a74a9e5f2a7fab2c1f531c099901
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f302a312dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
A QGraphicsEffect is not rendered inside a QGraphicsView so we must not
set it on a QComboBoxPrivateContainer. We have to do some checks for it
when a stylesheet is set as polish() is then called before the proxy
widget is set on the QComboBoxPrivateContainer. But luckily QComboBox
has the proxy widget already set so do the check there.
Pick-to: 6.8
Fixes: QTBUG-135340
Task-number: QTBUG-128916
Task-number: QTBUG-128329
Change-Id: I2426701f3aa44a2eb14b66846628dbb9cd16dc9f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 847c0bf076)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The EXECUTABLE argument must point to the full path of the created
executable, not just the file name. Otherwise,
qt_deploy_runtime_dependencies won't file the file.
Pick-to: 6.8
Change-Id: I18b6214b9f46c0ad4b99ca57468fe272efb9d718
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit e07b4d4394)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
_qt_internal_set_rpath was using CMAKE_INSTALL_PREFIX instead of
QT_DEPLOY_PREFIX for the destination path, which ends up trying to
adjust the rpath of plugins in the regular install destination, rather
than in DESTDIR.
Change the code to use QT_DEPLOY_PREFIX where appropriate.
Amends 5430fb2243
Pick-to: 6.8
Fixes: QTBUG-135620
Task-number: QTBUG-109553
Change-Id: Iea1c0b69ba93fa5e81c463df57f8c2e19703a66a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit ae4f9fe0cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Map PageTabList controls (i.e. QTabBar) to the TabGroup role, and
report the list of PageTabs as the tabs. Add a predicate-argument
to the unignoredChildren() function so that we can re-use that
logic to return the list of tabs, while also ignoring otherwise
accessible children, such as the scroll buttons.
Change-Id: I57472e9213dd178e018449e542de276051097073
Fixes: QTBUG-134807
Pick-to: 6.8
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0475bc57d6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Use qobject_cast<QComboBoxPrivateContainer *> instead
QObject::inherits() as this should be slightly faster and we have access
to the type so no need to use error-prone string comparison.
Pick-to: 6.8
Task-number: QTBUG-135340
Change-Id: I90ebb2323f21c2f5f9dd65bd7b1beeb32f1a91cc
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
(cherry picked from commit 7fdf7ad7e5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Replace an if-chain with a switch statement, and remove the duplicate
test for QAccessible::Client - we already ignore all such elements,
no matter their special role name.
Compare an object's className as a QByteArrayView, no need to expand to
a UTF16 QString just to compare with a Latin1 literal.
Pick-to: 6.8
Change-Id: I79f52277e4177f2a688216b7f5ef7469cfe0534c
Reviewed-by: Albert Astals Cid <aacid@kde.org>
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
(cherry picked from commit e88940941f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
We don't need to QUrlPrivate::appendPath() to a temporary variable under
QUrl::FullyEncoded mode and then setPath(). We can simply ask
appendPath() to write to the destination variable once and for all, so
long as we take care to ask it to use the encoding form that setPath()
uses (QUrl::PrettyDecoded, which is 0x0). That avoids the side trip
through FullyEncoded mode.
Pick-to: 6.8
Change-Id: I7908b9cf75742db07145fffd9499ce3b79492fdb
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 7ed94ef2b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Amends (reverts) commit 5e936b60fc, which
forced the encoding of the square brackets ("[]") into their percent-
encoded forms only in QUrl::fromLocalFile(). This commit expands the
functionality to all uses of decoded paths by applying the change
directly to recodeFromUser().
[ChangeLog][QtCore][QUrl] Square brackets ("[]") are now transformed to
their percent-encoded forms ("%5B" and "%5D") when present as inputs to
setPath(), setQuery(), and setFragment() if the parsing mode is
QUrl::DecodedMode (the default).
Pick-to: 6.8
Fixes: QTBUG-135433
Task-number: QTBUG-134073
See: https://bugs.kde.org/show_bug.cgi?id=502280
Change-Id: Id2b41559af08b5f228e4fffdb9c6f23120f856b5
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit f3da9d3c85)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The __has_cpp_attribute() refers to the attributes supported by the C++
language. GCC returns its knowledge of the C++ attribute in C, even when
the C code doesn't support it.
N2335[1] added the C++ attribute syntax to the C language and N2553[2] added
the __has_c_attribute() query syntax.
Known attributes:
From https://en.cppreference.com/w/c/language/attributes#Standard_attributes:
* [[deprecated]] (from N2334)
* [[fallthrough]] (from N2408)
* [[nodiscard]] (from N2267, with message in N2448)
* [[maybe_unused]] (from N2662)
* [[noreturn]] (from N2764, which also deprecates _Noreturn)
Drive-by remove C++11 & 14 support from [[nodiscard]]
[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2335.pdf
[2] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2553.pdf
Change-Id: Ifd32b2557683218e0d26fffd5b58dedf7911f77a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 4cd66686e4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Ensure the target is not an ALIAS target when adding the
transitive properties.
Pick-to: 6.8
Change-Id: Ic9cb4f1a6e110596e430176cfa9b7f742d2c3446
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d9ce5184c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
endFrame(SkipPresent) followed by beginFrame() would sometimes end
up waiting up to a second. We should not wait at all in this case.
D3D12 patch will follow separately.
Pick-to: 6.8
Change-Id: I3a5605c3fb672f9d68f2afb69645c5c47a5214b3
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit f2437c9d8c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
...to match 6.8 that has this added as part of a backport.
The D3D12 backend has this already. Still, move the
resetting of the variable to the outer scope in that one
too, to cover both code paths.
Change-Id: Ie4ba22ff9f2a2f6882dd2d5e3063c4e6701fa95c
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 35dd681f2b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Naming the private API "reparent()" was unfortunate. It is ambigous, as
it suggests that the QDockWidget argument may be parented to the group
window. In fact the opposite is the case: It is removed from the group
window and re-parented to the QMainWindow.
Rename the API into reparentToMainWindow(), which is what it does.
Amends e6d85cf28b.
Task-number: QTBUG-135442
Pick-to: 6.8 6.5
Change-Id: I6f9f37c190f3550348b1e4e14a8612d8880170dd
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit a0e0425a10)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
With the SH_ComboBox_AllowWheelScrolling style hint introduced in [1],
it's possible for combo boxes to not react to wheel scrolling. However,
since the event isn't explicitly ignored, it gets "eaten" by the combo
box instead of propagating up. This leads to upper level scroll areas
not receiving the event (and thus not scrolling).
By ignoring the event, the scroll area now scrolls if the hint is set
to false instead of nothing happening. This feels more intuitive and
mimics system behavior on both macOS (where the hint is set to false by
default) and Windows 11.
[1]: 5e9e4ccdc3
Pick-to: 6.8
Change-Id: I2207af8aad81fb76f3b1bbe074c3c4fbf22e3eca
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 9c966d837f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
INSTALL_DATADIR and INSTALL_ARCHDATADIR have the value "." by default.
CMP0177 in CMake 3.31 now warns when paths that have "." as a
component are passed to install().
To avoid the warning, change the implementation of qt_path_join, to
filter out "." components.
That way all install() calls that build up their paths via
qt_path_join() will avoid the warning.
Pick-to: 6.8
Change-Id: Ib82aa9fe6b5d32e374e8b1acf05402312b6dbe1a
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit a20f281212)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
If we add the first part of the XML document using a QBA overload of
the constructor or addData() method, the encoding of the document will
be extracted from the "encoding" attribute of the XML prolog.
This way, if the encoding is different from UTF-8, appending the data
with the QASV overload of addData() will always result in reading the
data incorrectly, because the implementation converts the input data
to UTF-8.
This test explicitly highlights this behavior.
In some cases the current behavior is probably fine. However, cases
like appending Latin1 to Latin1-encoded document or appending UTF-16
to UTF-16-encoded document should just work instead of doing the
unwanted conversion to UTF-8 and failing.
Task-number: QTBUG-124636
Task-number: QTBUG-135129
Pick-to: 6.8 6.5
Change-Id: Idf0571083e56032145478631538f09d251cb1022
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 046b8523f2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The tst_QXmlStream::runTestSuite() had two issues which resulted
in non-wellformed files not being checked in the incremental
parsing mode.
The first issue is that the TestSuiteHandler::endElement()
function calls isWellformed() twice with two different modes,
passing a pointer to a previously opened QFile to both calls.
As a result, the first call uses ParseSinglePass mode, which reads
the entire file at once. After that, the second call with
ParseIncrementally mode already uses a file which has
atEnd() == true. So, the call to readAll() simply returns an empty
QByteArray. So, the ParseIncrementally test was effectively a no-op.
This commit fixes it by explicitly calling seek(0) at the beginning
of the isWellformed() function and also changing the type of the
input parameter to be a QFile pointer instead of QIODevice pointer,
to make sure that seek(0) actually makes sense.
After that issue was solved, I noticed that in the incremental mode
the algorithm that was feeding the data to QXmlStreamReader
byte-by-byte was always skipping the first character (and also
reading past the end of the buffer). As a result, all the XML files
parsed in this mode were malformed.
This was fixed by moving the increment of the index after the
addData() call.
Finally, after these two things were fixed, six test cases from the
XML test suite started to fail, because the non-wellformed files
were incorrectly reported as well-formed.
Fix it by using StreamEOF instead of 0 in
QXmlStreamReaderPrivate::fastScanContentCharList().
The test case fixes amend the beginning of the public history.
The parser fix amends 817800ad39
which introduced StreamEOF instead of 0.
Fixes: QTBUG-135471
Pick-to: 6.8 6.5 5.15
Change-Id: I885166252d40819a4460ec246db10bf448e4a8e2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 633278fe1c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The fix [*] means this already passes on dev; and the belated pick to
6.8 should get there before this does (it landed before 6.9, so did
not need picked there).
[*] commit 5d656e5085
On 6.8, without the fix, the ISODate test passes (that's handled by a
sui generis parser) but all three of the fromStringFormat tests of
QDate, and the QDatetime exact reproducer from the bug report, provoke
assertion failures.
Task-number: QTBUG-135382
Pick-to: 6.8
Change-Id: I303df9215873e37a9f2cbf5a78aab8ffa48f67aa
Reviewed-by: Albert Astals Cid <aacid@kde.org>
(cherry picked from commit 79a1986e86)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
QMainWindowLayout::unusedTabBars contains unparented tab bars.
They are leaked when QMainWindow and its layout get destroyed.
They still are in QApplication::allWidgets(), which attempts to delete
them eventually. When that happens, they try to remove themselves from
an already deleted QMainWindowLayout::unusedTabBars.
Delete all unused tab bars in the d'tor of QMainWindowLayout.
Task-number: QTBUG-135468
Pick-to: 6.8 6.5
Change-Id: I5ac7748ef738955522567db585e9505e3ba435ad
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 23357e59bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Amends b6b489db69, which introduced UB
(invalid downcast):
By the time the
QMainWindowTabBars are destroyed, and they want to unregister
themselves from the QMainWindow, the ex-QMainWindow has already been
demoted to a QWidget. Says UBSan:
qmainwindow.cpp:63:47: runtime error: member call on address 0x6040000267d0 which does not point to an object of type 'QMainWindow'
0x6040000267d0: note: object is of type 'QWidget'
00 00 00 00 28 c1 e6 f3 c7 7f 00 00 80 24 00 00 60 61 00 00 d8 c2 e6 f3 c7 7f 00 00 00 00 be be
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QWidget'
#0 0x7fc7f06da8c5 in QMainWindowPrivate::mainWindowLayout(QMainWindow const*) qmainwindow.cpp:63
#1 0x7fc7f06da8c5 in qt_mainwindow_layout(QMainWindow const*) qmainwindow.cpp:69
#2 0x7fc7f07bb4ed in QMainWindowTabBar::~QMainWindowTabBar() qmainwindowlayout.cpp:2042
#3 0x7fc7f07bf4e5 in QMainWindowTabBar::~QMainWindowTabBar() qmainwindowlayout.cpp:2047
#4 0x7fc7c69f9c2a in QObjectPrivate::deleteChildren() qobject.cpp:2226
#5 0x7fc7ef0b7f3d in QWidget::~QWidget() qwidget.cpp:1557
#6 0x7fc7f082c7c7 in QDockWidgetGroupWindow::~QDockWidgetGroupWindow() qmainwindowlayout_p.h:343
#7 0x7fc7f082c7c7 in QDockWidgetGroupWindow::~QDockWidgetGroupWindow() qmainwindowlayout_p.h:343
#8 0x7fc7c69f9c2a in QObjectPrivate::deleteChildren() qobject.cpp:2226
#9 0x7fc7ef0b7f3d in QWidget::~QWidget() qwidget.cpp:1557
#10 0x7fc7f06ce495 in QMainWindow::~QMainWindow() qmainwindow.cpp:338
#12 0x556a6180a84c in std::default_delete<QMainWindow>::operator()(QMainWindow*) const unique_ptr.h:85
#13 0x556a6180a84c in std::unique_ptr<QMainWindow, std::default_delete<QMainWindow> >::~unique_ptr() unique_ptr.h:361
#14 0x556a6180a84c in tst_QDockWidget::setFloatingReparenting() tst_qdockwidget.cpp:492
Use qobject_cast to verify that the mainWindow is not pointing to a
QMainWindow that is being destroyed (and has passed the ~QMainWindow
destructor). If the main window is destroyed, then removing the tab bar
from the list of unused tab bars is unnecessary.
Pick-to: 6.8 6.5
Change-Id: I25e12d79198137b75cd2576ff1440b6c94277eba
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 1bbbacbecb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Instead of aggregating a QMutableSinglePointEvent by value, which
depends on the QEvent copy assignment operator, and casting it to a
QMouseEvent that it isn't, introduce QEventStorage which is a bit like
std::optional, but, by each event subclass befriending it, can store
event copies by-value, unlike clone(), which is restricted to the
heap. We could have befriended std::optional<QMouseEvent>, too, but by
adding our own type in _p.h, we can better control which code uses
this dangerous construct.
Added a guard to avoid clobbering lastMouseEvent with a copy of itself
in storeMouseEvent(). Before, we'd self-assign to lastMouseEvent,
which didn't invalidate the reference. Now, a store() is the
equivalent of a dtor + copy constructor, so we need to be a bit more
careful.
Fixes UBSan reports when running tst_qgraphicsview:
qgraphicsview/qgraphicsview.cpp:612:27: runtime error: downcast of address 0x61a000035e90 which does not point to an object of type 'QMouseEvent'
0x61a000035e90: note: object is of type 'QMutableSinglePointEvent'
00 00 00 00 30 47 ef 8b 99 7f 00 00 02 00 00 00 00 00 00 e0 d0 91 00 00 20 60 00 00 00 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QMutableSinglePointEvent'
#0 0x7f99a27c7a47 in QGraphicsViewPrivate::replayLastMouseEvent() qgraphicsview.cpp:612
qgraphicsview.cpp:653:39: runtime error: member call on address 0x61a0000fe290 which does not point to an object of type 'QMouseEvent'
0x61a0000fe290: note: object is of type 'QMutableSinglePointEvent'
00 00 00 00 30 47 ef 8b 99 7f 00 00 05 00 00 00 00 00 00 e0 d0 91 00 00 20 60 00 00 00 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QMutableSinglePointEvent'
#0 0x7f99a27c3609 in QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent*) qgraphicsview.cpp:653
#1 0x7f99a27c7832 in QGraphicsViewPrivate::replayLastMouseEvent() qgraphicsview.cpp:612
qgraphicsview.cpp:654:37: runtime error: member call on address 0x61a0000fe290 which does not point to an object of type 'QMouseEvent'
0x61a0000fe290: note: object is of type 'QMutableSinglePointEvent'
00 00 00 00 30 47 ef 8b 99 7f 00 00 05 00 00 00 00 00 00 e0 d0 91 00 00 20 60 00 00 00 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QMutableSinglePointEvent'
#0 0x7f99a27c358b in QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent*) qgraphicsview.cpp:654
#1 0x7f99a27c7832 in QGraphicsViewPrivate::replayLastMouseEvent() qgraphicsview.cpp:612
Task-number: QTBUG-99563
Change-Id: Ib642d416b8aef98c7fd8b1fa164ec2449189992a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit dd264cc9c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
On my machine, the window manager opened the QComboBox always at y = 0
(top edge of the screen), where the popup, being confined to the
screen geometry, had no chance of "open[ing] up centered on top of the
current index".
Fix by centering the widget on screen.
Amends 8393922e70.
Pick-to: 6.8 6.5
Change-Id: I7b4d066aa1e555f3d5cc1d5e0c88b1d835bf2b26
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit e2790a6758)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Purely from a symmetry argument, we should be disconnecting the old
item delegate, not the new one.
I didn't find a case where this actually causes test failures, nor did
I take the time to implement a test where it does.
Amends a126d3627c. That patch landed in
Qt 6.7, but that branch is "closed" at this point in time, so not
picking there now.
Pick-to: 6.8
Change-Id: I06b704e699616d61c65ad676ffe45dfbd9f8a870
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e5f11eebc8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Tidies up the test output by removing expected warnings from the log
(and alerting us if they're missing).
Amends 64f6169f61, which introduced the
warning.
Pick-to: 6.8 6.5 5.15
Change-Id: Idcef99d556b11035307e6e207cf31fc2f13ed291
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit e55479ea4a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
The minimumContentsLength() is user-settable, and tst_QComboBox
actually sets it to INT_MAX as some point. As such, the implementation
needs to defend itself from UB, either by limiting what values it
accepts as minimumContentsLength() or by making sure it doesn't cause
signed overflow in calculations involving this user-controlled
variable.
The former doesn't really work as long as the test checks that INT_MAX
is accepted as-is, so we need to do the latter.
Do the calculation in qint64, and use the result only when it doesn't
exceeed good old QWIDGETSIZE_MAX.
Amends the start of the public history.
Pick-to: 6.8 6.5 5.15
Change-Id: I8aac7bda593095638c9c09db3b70b4c84e698419
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 00fdf9e432)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
QProxyStyle's ctor arguments are not QObject parents, but the proxied
style, which becomes the proxy's QObject ... get this ... _child_.
What a broken concept... It means that this test function took
ownership of QApplication::style(), and the only way it wasn't going
to wreak havoc on the rest of the test functions was to leak it after
use.
To fix, create the style on the stack, so it gets automatically freed
by the compiler on all exists from the function. As a drive-by, use {}
instead of () to call the ctor (not to prevent C++' Most Vexing Parse,
just because it's easier on the eye).
The meat of the change, however, is in making the helper proxy-style
defend against QProxyStyle's grabbing of the baseStyle() as its child,
and managing baseStyle()->d->proxyStyle so we properly dissociate from
qApp->style() after we're done. Needed to use ctor delegation to
extract original parent and proxy model from the incoming style before
QProxyStyle, our first subobject, gets first picking on the style,
destroying the very state we're trying to preserve.
This should be become some QTest::LocalProxyStyle, if we find more
users of this pattern.
Amends 5cff7d2b67.
Pick-to: 6.8 6.5 5.15
Change-Id: I2abf4a0bf54158254fd8d526de55ad486ca4e296
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit d884591391)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Both the QCompleter and the QSortFilterProxy objects are not owned by
the QComboBox merely by setting them as completer and model. Having no
other QObject parents, and having being allocated on the heap, they
were leaked.
To fix, give them the combo-box as QObject parent.
Amends 8b6d6d4832.
Pick-to: 6.8 6.5 5.15
Change-Id: I5c3594272a5283a3fbaeb9885d315047b04f30de
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 27279e01d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
A QComboBox does not own the model set on it, because models can be in
many views at once. So the QStringListModel, allocated on the heap
without a QObject parent was leaked.
Fix by giving the model the combo-box as QObject parent.
Amends the start of the public history.
Pick-to: 6.8 6.5 5.15
Change-Id: Idd9057c8f796937d9d3c5c4ef99b329124d2192d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit c41592c900)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
QItemDelegates are owned by neither the QComboBox directly, nor the
QComboBox::view(), upon a mere setItemDelegate() (the docs of this
function is pretty clear about that). Since the objects didn't have a
QObject parent, either, they were leaked.
To fix, give it the comboBox as a parent.
Amends the start of the public history.
Pick-to: 6.8 6.5 5.15
Change-Id: Ic8bc2603072070b458bd79a6129af6c76811f8ec
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit fda3526f9c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Contrary to what the code comment suggested, a QComboBox does not own
the object passed in by setItemDelegate(). After a nullptr check, the
function merely forwards to QComboBox::view()->setItemDelegate() and
QAbstractItemView::setItemDelegate() documents very clearly that the
item delegate ownership does not change. Consequently, the test
function leaked the object.
To fix, hold it in a unique_ptr and reset() at the end of the code
block.
I opted to not merely comment in the delete there, because that would
still leak in case one of the QCOMPARE()s in-between failed. While it
is not the purpose of the current work to make tests leak-free even on
failure, it likewise makes little sense to not reap this small benefit
now, albeit at the cost of a bit of git history mess-up, itself
mediated by the fact that we're picking this all the way back, since
this...
Amends the start of the public history.
Pick-to: 6.8 6.5 5.15
Change-Id: I1e604b795f5a12dc8829bf5913b88bc7c7110352
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 0de7cafabc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>