Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.2.3, 6.5
-
None
-
-
5a9fbae0b (dev), 80eba4bb9 (6.4), 35e7c8497 (6.5), 5695f1d8c (tqtc/lts-6.2)
Description
We had the issue with a real program on some machines, but not on others. I however suspect this timing issue is not reflected in the attached example (that I suspect will crash always). The problem is that actionsRects are not set in native mode, and when the native mode is turned off the items dirty flag is not marked dirty (which it should)
Alternatively caclActionRects could (maybe?) check if actionRects were identically sized to actions before bailing out. (However if native window is in use it may be acceptable they are not similar sized?)
I am a bit busy and there is an easy workaround by setting nativeMenu as false first, but I will still be happy to review/approve a change (with a unit test).
QSize QMenuBar::minimumSizeHint() const { Q_D(const QMenuBar); const bool as_gui_menubar = !isNativeMenuBar(); ensurePolished(); QSize ret(0, 0); const_cast<QMenuBarPrivate*>(d)->updateGeometries(); const int hmargin = style()->pixelMetric(QStyle::PM_MenuBarHMargin, nullptr, this); const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, this); int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, this); int spaceBelowMenuBar = style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, nullptr, this); if (as_gui_menubar) { int w = parentWidget() ? parentWidget()->width() : QGuiApplication::primaryScreen()->virtualGeometry().width(); d->calcActionRects(w - (2 * fw), 0); for (int i = 0; ret.isNull() && i < d->actions.count(); ++i) ret = d->actionRects.at(i).size(); // *BOOM :( - index out of range*
Attachments
For Gerrit Dashboard: QTBUG-102107 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
465851,3 | QMenuBar: Mark items as dirty when switching away from native menu bar | dev | qt/qtbase | Status: MERGED | +2 | 0 |
466425,2 | QMenuBar: Mark items as dirty when switching away from native menu bar | 6.5 | qt/qtbase | Status: MERGED | +2 | 0 |
466426,2 | QMenuBar: Mark items as dirty when switching away from native menu bar | 6.4 | qt/qtbase | Status: MERGED | +2 | 0 |
466428,2 | QMenuBar: Mark items as dirty when switching away from native menu bar | tqtc/lts-6.2 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |