When the test functions runs off the end (or returns from a failed QCOMPARE/QVERIFY), `activeMenu` is destroyed while it's the QMenuBarPrivate::activeMenu, and the following focusInEvent() on the QMenuBar causes QMenuBarPrivate::setCurrentAction() to access `activeMenu` when it has already ceased to be a QMenu. Says UBSan: qpointer.h:75:14: runtime error: downcast of address 0x7fff87934860 which does not point to an object of type 'QMenu' 0x7fff87934860: note: object is of type 'QWidget' 00 00 00 00 08 f1 0e be 17 7f 00 00 80 c8 00 00 90 61 00 00 b8 f2 0e be 17 7f 00 00 00 00 62 c6 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'QWidget' #0 0x7f17baf57be5 in QPointer<QMenu>::data() const qpointer.h:75 #1 0x7f17baf57be5 in QPointer<QMenu>::operator QMenu*() const qpointer.h:83 #2 0x7f17baf57be5 in QMenuBarPrivate::setCurrentAction(QAction*, bool, bool) qmenubar.cpp:351 #3 0x7f17baf5a200 in QMenuBarPrivate::focusFirstAction() qmenubar.cpp:245 #4 0x7f17baf5b727 in QMenuBarPrivate::focusFirstAction() qmenubar.cpp:1260 #5 0x7f17baf5b727 in QMenuBar::focusInEvent(QFocusEvent*) qmenubar.cpp:1259 [...] #34 0x7f17b93373d6 in QWidget::~QWidget() qwidget.cpp:1508 #35 0x7f17badb4658 in QMenu::~QMenu() qmenu.cpp:1789 Since I couldn't fix the problem on short notice, I created QTBUG-135151 to track it. For now, simply close the QMenuBar on all exists from the test function to avoid this code path. Task-number: QTBUG-135151 Pick-to: 6.9 6.8 6.5 Change-Id: Id8c9ee090d8bbc5ec22ce3f2ff7485766640ab43 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
…
…
Description
Languages
C++
84.3%
HTML
4.9%
C
3.9%
CMake
3.6%
Objective-C++
2%
Other
0.8%