- 
    
Bug
 - 
    Resolution: Done
 - 
    
P2: Important
 - 
    5.15.8, 5.15.10, 6.4.0 FF
 
- 
        
 - 
        2ed54dedf3 (qt/qtbase/dev) 2ed54dedf3 (qt/tqtc-qtbase/dev) 1ed89b7012 (qt/qtbase/6.4) 1ed89b7012 (qt/tqtc-qtbase/6.4) 53e3c7ed9f (qt/qtbase/6.3) 53e3c7ed9f (qt/tqtc-qtbase/6.3) 5b409aa872 (qt/tqtc-qtbase/6.2) da4f2177f8 (qt/tqtc-qtbase/5.15)
 
After QMainWindow::restoreState() is called the widgetItem is set to nullptr for the toolbar. Which can lead to crash in some situation.
When looking into more deeper, A toolbar knows the layout item (it is a QWidgetItemV2 instance) which are wrapped in (via QWidgetPrivate::widgetItem) But after QMainWindow::restoreState the widgetItem is set to nullptr for the toolbar, although there is a new layout item containing it.
I attached a small program to reproduce the problem. It logs Null pointer after restoreState.