Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-44540

QDockAreaLayoutInfo crashes in restoreState (l. 1978-9) when restoring closed, floating QDockWidget

    XMLWordPrintable

Details

    • macOS
    • e6d85cf28 (dev), a884cf6e8 (tqtc/lts-6.5), 9557d1ca9 (6.6)

    Description

      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.

      Attachments

        For Gerrit Dashboard: QTBUG-44540
        # Subject Branch Project Status CR V

        Activity

          People

            axelspoerl Axel Spoerl
            pbenard Pierre Benard
            Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes