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

Application crash when dialog-based window was closed and then shown again.

    XMLWordPrintable

Details

    • deac052a40c93633041da058d5c73c9e91aa76c7

    Description

      Case

      **I have a dialog-based widget (Qt :: WA_DeleteOnClose is false) which I create one time and then show and hide  many times.

      When I close the widget and open it again then I see undefined behavior or application crash.

      This began to happen when I switched to a Qt 5.12.4 instead of the 5.9 version.

      Simple application is attached.  

      Assumptions

      Some internal objects of QWidget that affect drawing are deleted when a QDialog-based object is closing.This happens despite that the attribute Qt :: WA_DeleteOnClose is false. The next time when the dialog is displayed, then it causes undefined behavior or application crash. 

      I found it in Qt 5.12.4 and I don't find it in Qt 5.9.

      Attachement description.

      Application contains two QDialog-based classes: MainDialog and SecondDialog. 

      MainDialog creates SecondDialog in constructor with attribute Qt :: WA_DeleteOnClose = false. MainDialog shows SecondDialog each time then user clicks "Show Second" button.

      SecondDialog contains system menu bar, push button "Hide" and text edit with multi-line text (automated vertical scroll bar is shown). When user click "Hide", SecondDialog object handles hideEvent. When user click close button in system menu then SecondDialog handles closeEvent.

      It is expected that closeEvent and the hideEvent should cause to only hiding the window. In Qt 5.9 it's true but in Qt 5.12.4 it's not.

      Steps to view the crash.

      1. Extract attached scrollBug_12.zip and build it (Desktop Qt 5.12.4 MinGV 64bit (debug or release) for Windows)
      2. Run application; 
      3. Click "Show Second" button.  SecondDialog window will be shown.
      4. Click close button in system menu. SecondDialog will be closed.
      5. Click "Show Second" button again.  SecondDialog window will be shown again.
      6. Try to scroll text in SecondDialog. Application will be crashed.

      Note. If on step 4 you click "Hide" button then on step 6 application will not be crashed. 

       

      Attachments

        Issue Links

          Activity

            People

              vestbo Tor Arne Vestbø
              tsurko.dmitry Dzmitry Tsurko
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: