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

QCocoaBackingStore::paintDevice() crashes when showing window after hide

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P1: Critical
    • None
    • 5.6.0 Beta
    • GUI: Window management
    • None
    • MAC OS X 10.11.3

    Description

      After hiding and then showing a particular window again, QCocoaBackingStore::paintDevice() crashes as cocoaWindow is a null pointer.

      The window has a QVBoxLayout and contains the following:

      • a custom widget without layout which contains two widgets, the second of which is hidden (this was a top level widget until is was added to this widget). This widget's size is exactly that of the visible widget
      • a custom widget without layout (same class as the previous one) containing two widgets, the second of which is a QMainWindow with a toolbar (the QMainWindow was a top level widget until it was added to this widget). Both sub widgets are visible.
      • a QFrame with a horizontal line
      • stretch

      When the widget is originally shown and populated it behaves as it should (resizing and repositioning all work as expected), however if it is hidden and then shown again, the application crashes (stack trace below).
      I've tried skipping everything in the but the return statement in the paintDevice() method if the cocoaWindow is null but that has the following consequences:

      • the window looks messed up after the show.
      • after an attempt to resize the window, it appears the winId is no longer valid: casting the winId (requested at that moment, not a stored value) to an NSView * and requesting the window from that NSView crashes)

      Stack trace:

      #0	0x000000012f927ab2 in QCocoaBackingStore::paintDevice() at qt-everywhere-opensource-src/qtbase/src/plugins/platforms/cocoa/qcocoabackingstore.mm:54
      #1	0x0000000129daf853 in QBackingStore::beginPaint(QRegion const&) at qt-everywhere-opensource-src/qtbase/src/gui/painting/qbackingstore.cpp:174
      #2	0x000000010c4955e8 in QWidgetBackingStore::beginPaint(QRegion&, QWidget*, QBackingStore*, BeginPaintInfo*, bool) at qt-everywhere-opensource-src/qtbase/src/widgets/kernel/qwidgetbackingstore.cpp:317
      #3	0x000000010c49ac15 in QWidgetBackingStore::doSync() at qt-everywhere-opensource-src/qtbase/src/widgets/kernel/qwidgetbackingstore.cpp:1303
      #4	0x000000010c499835 in QWidgetBackingStore::sync(QWidget*, QRegion const&) at qt-everywhere-opensource-src/qtbase/src/widgets/kernel/qwidgetbackingstore.cpp:1091
      #5	0x000000010c4d331e in QWidgetPrivate::syncBackingStore(QRegion const&) at qt-everywhere-opensource-src/qtbase/src/widgets/kernel/qwidget.cpp:1942
      #6	0x000000010c518051 in QWidgetWindow::handleExposeEvent(QExposeEvent*) at qt-everywhere-opensource-src/qtbase/src/widgets/kernel/qwidgetwindow.cpp:823
      #7	0x000000010c515afe in QWidgetWindow::event(QEvent*) at qt-everywhere-opensource-src/qtbase/src/widgets/kernel/qwidgetwindow.cpp:255
      #8	0x000000010c48117e in QApplicationPrivate::notify_helper(QObject*, QEvent*) at qt-everywhere-opensource-src/qtbase/src/widgets/kernel/qapplication.cpp:3712
      #9	0x000000010c483039 in QApplication::notify(QObject*, QEvent*) at qt-everywhere-opensource-src/qtbase/src/widgets/kernel/qapplication.cpp:3155
      #10	0x000000012abc8988 in QCoreApplication::notifyInternal2(QObject*, QEvent*) at qt-everywhere-opensource-src/qtbase/src/corelib/kernel/qcoreapplication.cpp:1013
      #11	0x0000000129b679d1 in QCoreApplication::sendSpontaneousEvent(QObject*, QEvent*) at qt-everywhere-opensource-src/qtbase/include/QtCore/../../src/corelib/kernel/qcoreapplication.h:230
      #12	0x0000000129b62aa1 in QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent*) at qt-everywhere-opensource-src/qtbase/src/gui/kernel/qguiapplication.cpp:2695
      #13	0x0000000129b5e756 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) at qt-everywhere-opensource-src/qtbase/src/gui/kernel/qguiapplication.cpp:1689
      #14	0x0000000129b3d732 in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) at qt-everywhere-opensource-src/qtbase/src/gui/kernel/qwindowsysteminterface.cpp:636
      #15	0x0000000129b3b3b2 in QWindowSystemInterface::flushWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) at qt-everywhere-opensource-src/qtbase/src/gui/kernel/qwindowsysteminterface.cpp:614
      #16	0x000000012f92d23a in QCocoaWindow::setVisible(bool) at qt-everywhere-opensource-src/qtbase/src/plugins/platforms/cocoa/qcocoawindow.mm:668
      #17	0x0000000129b6faa8 in QWindow::setVisible(bool) at qt-everywhere-opensource-src/qtbase/src/gui/kernel/qwindow.cpp:523
      #18	0x000000010c4e26db in QWidgetPrivate::show_sys() at qt-everywhere-opensource-src/qtbase/src/widgets/kernel/qwidget.cpp:7954
      #19	0x000000010c4e3f1e in QWidgetPrivate::show_helper() at qt-everywhere-opensource-src/qtbase/src/widgets/kernel/qwidget.cpp:7882
      #20	0x000000010c4e3cde in QWidgetPrivate::show_recursive() at qt-everywhere-opensource-src/qtbase/src/widgets/kernel/qwidget.cpp:7751
      #21	0x000000010c4e4164 in QWidgetPrivate::showChildren(bool) at qt-everywhere-opensource-src/qtbase/src/widgets/kernel/qwidget.cpp:8249
      #22	0x000000010c4e3d58 in QWidgetPrivate::show_helper() at qt-everywhere-opensource-src/qtbase/src/widgets/kernel/qwidget.cpp:7827
      #23	0x000000010c4e3cde in QWidgetPrivate::show_recursive() at qt-everywhere-opensource-src/qtbase/src/widgets/kernel/qwidget.cpp:7751
      #24	0x000000010c4e4164 in QWidgetPrivate::showChildren(bool) at qt-everywhere-opensource-src/qtbase/src/widgets/kernel/qwidget.cpp:8249
      #25	0x000000010c4e3d58 in QWidgetPrivate::show_helper() at qt-everywhere-opensource-src/qtbase/src/widgets/kernel/qwidget.cpp:7827
      #26	0x000000010c4e4ba4 in QWidget::setVisible(bool) at qt-everywhere-opensource-src/qtbase/src/widgets/kernel/qwidget.cpp:8168
      #27	0x000000010c4e3bdc in QWidget::show() at qt-everywhere-opensource-src/qtbase/src/widgets/kernel/qwidget.cpp:7728
      

      Attachments

        Issue Links

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

          Activity

            People

              dedietri Gabriel de Dietrich (drgvond)
              gvanvoor Gregory Van Vooren
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes