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. Change-Id: I1c6eb9e9d2c9444fcb9bd1d1d9c345237dc72b33 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 1f6dbbd53969837cc4ff59f39dbb4c06d700a689) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
2d32e38e3a
commit
3ad55194a4
@ -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…
x
Reference in New Issue
Block a user