Assert that we have a layout before dereferencing
Since we test the pointer in the beginning, it might be nullptr. But if we receive events that require a layout, then it must not be nullptr. Assert that assumption. Address static analyzer warning 06f8cc945ead26f20c6b9599faf76c83. Pick-to: 6.1 Change-Id: I1c6eb9e9d2c9444fcb9bd1d1d9c345237dc72b33 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>bb10
parent
52b5e9b766
commit
1f6dbbd539
|
|
@ -1306,6 +1306,7 @@ bool QMainWindow::event(QEvent *event)
|
|||
|
||||
#if QT_CONFIG(toolbar)
|
||||
case QEvent::ToolBarChange: {
|
||||
Q_ASSERT(d->layout);
|
||||
d->layout->toggleToolBarsVisible();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1314,6 +1315,7 @@ bool QMainWindow::event(QEvent *event)
|
|||
#if QT_CONFIG(statustip)
|
||||
case QEvent::StatusTip:
|
||||
#if QT_CONFIG(statusbar)
|
||||
Q_ASSERT(d->layout);
|
||||
if (QStatusBar *sb = d->layout->statusBar())
|
||||
sb->showMessage(static_cast<QStatusTipEvent*>(event)->tip());
|
||||
else
|
||||
|
|
@ -1324,6 +1326,7 @@ bool QMainWindow::event(QEvent *event)
|
|||
|
||||
case QEvent::StyleChange:
|
||||
#if QT_CONFIG(dockwidget)
|
||||
Q_ASSERT(d->layout);
|
||||
d->layout->layoutState.dockAreaLayout.styleChangedEvent();
|
||||
#endif
|
||||
if (!d->explicitIconSize)
|
||||
|
|
|
|||
Loading…
Reference in New Issue