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

QWidgetWindow: Events are sent to deleted widget on destruction

    XMLWordPrintable

Details

    • 6a84a51611f69f3641ae47bbd7b6bd5266ae88ef ce37467acf34edf1380f896a0942b616dc4cbead

    Description

      The destruction sequence of top-level QWidgets results on QWidgetWindow sending an event to its widget while it's running ~QObject(), and therefore after it has run ~QWidget(). The sequence is (omitting a few calls):

      ~QWidget() -->
      ~QObject() -->
      ~QWidgetPrivate() -->
      QWidgetPrivate::deleteTLSysExtra() -->
      QWindow::destroy() -->
      QWidgetWindow::event()
      

      This results in two issues. First, QWidgetWindow expects its widget to be a QWidget after ~QWidget() has been called. Second, any event filter or QApplication::notify() override has to deal with a QObject being deleted without having a way of checking that (as an example, trying to instantiate a QPointer with that object will cause an immediate assert failure).

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            dedietri Gabriel de Dietrich (drgvond)
            dedietri Gabriel de Dietrich (drgvond)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes