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

Crash when deleting a dialog containing Q3ListView

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 4.8.6, 4.8.7
    • None

    Description

      When you show a dialog window containing a Q3ListView, close the dialog and then disable the "always on top" feature of the main window, then deleting the dialog causes a crash. Seems it fails to unregister from Qt's backing store (stack trace below).

      More precisely, the following sequence of events causes a crash:

      1) Create a QMainWindow
      2) Show a QDialog containing a Q3ListView instance, with main window being its parent
      3) Close the dialog
      4) Modify main window's WindowFlags:

      setAttribute(Qt::WA_Resized, true);
      Qt::WindowFlags flags = windowFlags();
      setWindowFlags(flags ^ (Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint));
      
      setVisible(true);
      

      5) Delete the dialog

      The crash occurs in qbackingstore.cpp in line 499 (marked with a comment):

      for (int i = 0; i < count; ++i) {
      QWidget *w = staticWidgets.at(i);
      QWidgetPrivate *wd = w->d_func();
      if (!wd->isOpaque || !wd->extra || wd->extra->staticContentsSize.isEmpty()// *
                  || !w->isVisible() || (parent && !parent->isAncestorOf(w))) {
                  continue;
              }
      

      because wd points to a deleted widget.

      Full stack trace:

      QtGuid4.dll!QWidgetBackingStore::staticContents(QWidget * parent, const QRect & withinClipRect) Line 499 C++
      QtGuid4.dll!QWidgetBackingStore::sync() Line 1200 C++
      QtGuid4.dll!QWidgetPrivate::syncBackingStore() Line 1896 C++
      QtGuid4.dll!QWidget::event(QEvent * event) Line 8694 C++
      QtGuid4.dll!QMainWindow::event(QEvent * event) Line 1479 C++
      QtGuid4.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 4565 C++
      QtGuid4.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 4530 C++
      QtCored4.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent * event) Line 955 C++
      QtCored4.dll!QCoreApplication::sendEvent(QObject * receiver, QEvent * event) Line 231 C++
      QtCored4.dll!QCoreApplicationPrivate::sendPostedEvents(QObject * receiver, int event_type, QThreadData * data) Line 1579 C++
      QtCored4.dll!qt_internal_proc(HWND__ * hwnd, unsigned int message, unsigned __int64 wp, __int64 lp) Line 498 C++
      [External Code]
      QtCored4.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 823 C++
      QtGuid4.dll!QGuiEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 1216 C++
      QtCored4.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 150 C++
      QtCored4.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 204 C++
      QtCored4.dll!QCoreApplication::exec() Line 1227 C++
      QtGuid4.dll!QApplication::exec() Line 3824 C++
      qt_bug.exe!main(int argc, char * * argv) Line 58 C++
      qt_bug.exe!WinMain(HINSTANCE__ * instance, HINSTANCE__ * prevInstance, char * __formal, int cmdShow) Line 131 C++

      .

      Please find a complete example that reproduces the issue in the attachment.

      Remarks:

      • In the attached example, all steps are contained in one function (go) for simplicity. The crash occurs even when the dialog is shown on the screen, closed by the user, and then deleted.
      • When you change delete dialog; to dialog->deleteLater(); it will crash anyway
      • When you change Q3ListView to QWidget it won't crash
      • When you change Q3ListView to Q3Table or Q3DataTable it will crash also

      Attachments

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

        Activity

          People

            sletta Gunnar Sletta
            bartoszkp BartoszKP
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes