- 
    
Bug
 - 
    Resolution: Fixed
 - 
    
P4: Low
 - 
    5.3.2, 5.4.0
 - 
    None
 - 
    Mac OS X
 
- 
        
 - 
        e6d85cf28 (dev), a884cf6e8 (tqtc/lts-6.5), 9557d1ca9 (6.6)
 
Inside the constructor of a class inheriting QMainWindow, I create ten QDockWidgets, that are initially docked. Then I save the state of the QMainWindow inside a QByteArray variable
(defaultState)
.
If one of those QDockWidget is undocked and closed, my application crashes at line 1978 of "qdockarealayout.cpp" when I call 
restoreState(defaultState);
.
In any other situation (when moving QDockWidgets, closing them without undocking, undocking them without closing...), or if I explicitly call
setFloating(false);
in
QDockWidget::closeEvent
, it works as expected: the main window and docks are properly restored. 
Note that I only ran into this problem on Mac OS X. I tested on Linux and Windows, and it seems to work fine.
From what I have seen when debugging, the problem comes from
widget->setFloating(false);
at line 1979 of "qdockarealayout.cpp". After this method is called on a floating, closed QDockWidget, its containing QDockAreaLayoutInfo object is in a bad state. But I didn't manage to track down the problem further.