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

macOS: Crash when disconnecting screen when app is in fullscreen

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 6.5.8, 6.8.1, 6.9.0 FF
    • 6.2.4
    • QPA
    • None
    • macOS Sonoma 14.5
    • macOS
    • 58caa18d2 (dev), 11c8b80f4 (6.8), 82b1f8ead (tqtc/lts-6.5), a6b79728b (tqtc/lts-6.2)

    Description

      Our app sometimes crashes with the attached stack, and today I finally managed to repro it locally (although not consistently). The issue seems to be that when disconnecting a screen, a resize event is sometimes fired setting m_requestedSize in QCALayerBackingStore to an empty size, causing the IOSurface creation to return null, which in turn later crashes in the buffer.

      Repro steps:

      • Connect a screen to a macbook
      • Close the lid of the macbook
      • Fullscreen the app on the connected screen
      • Disconnect the screen
      • Open the lid of the macbook

      This also seems to happen if an attached screen goes to sleep, so it is quite severe for our users.

      Since I'm still on 6.2.4 I've looked through commits in dev for related fixes but found none, but it is possible this is a fixed issue already.

      #3  0x000000010bb79794 in qt_message_fatal(QtMsgType, QMessageLogContext const&, QString const&) at .../qtbase/src/corelib/global/qlogging.cpp:1905
      #4  0x000000010c146bb4 in QMessageLogger::fatal(char const*, ...) const at .../qtbase/src/corelib/global/qlogging.cpp:890
      #5  0x000000010c1465a8 in qt_assert(char const*, char const*, int) at .../qtbase/src/corelib/global/qglobal.cpp:3292
      #6  0x0000000106c0e004 in QIOSurfaceGraphicsBuffer::QIOSurfaceGraphicsBuffer(QSize const&, QPixelFormat const&) at .../qtbase/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm:80
      #7  0x0000000106b78c30 in QCALayerBackingStore::GraphicsBuffer::GraphicsBuffer(QSize const&, double, QPixelFormat const&, QCFType<CGColorSpace*>) at .../qtbase/src/plugins/platforms/cocoa/qcocoabackingstore.mm:563
      #8  0x0000000106b7550c in QCALayerBackingStore::GraphicsBuffer::GraphicsBuffer(QSize const&, double, QPixelFormat const&, QCFType<CGColorSpace*>) at .../qtbase/src/plugins/platforms/cocoa/qcocoabackingstore.mm:566
      #9  0x0000000106b74864 in QCALayerBackingStore::recreateBackBufferIfNeeded() at .../qtbase/src/plugins/platforms/cocoa/qcocoabackingstore.mm:231
      #10 0x0000000106b7398c in QCALayerBackingStore::beginPaint(QRegion const&) at .../qtbase/src/plugins/platforms/cocoa/qcocoabackingstore.mm:128
      #11 0x000000010a52a9fc in QBackingStore::beginPaint(QRegion const&) at .../qtbase/src/gui/painting/qbackingstore.cpp:138
      #12 0x0000000107b17c94 in QWidgetRepaintManager::paintAndFlush() at .../qtbase/src/widgets/kernel/qwidgetrepaintmanager.cpp:936
      #13 0x0000000107b1810c in QWidgetRepaintManager::sync() at .../qtbase/src/widgets/kernel/qwidgetrepaintmanager.cpp:717
      #14 0x0000000107ae0884 in QWidgetPrivate::syncBackingStore() at .../qtbase/src/widgets/kernel/qwidget.cpp:1748
      #15 0x0000000107af7770 in QWidget::event(QEvent*) at .../qtbase/src/widgets/kernel/qwidget.cpp:9017
      #16 0x00000001012a9cf8 in MainWindow::event(QEvent*) at .../src/windows/mainwindow.cpp:2550
      #17 0x0000000107a54678 in QApplicationPrivate::notify_helper(QObject*, QEvent*) at .../qtbase/src/widgets/kernel/qapplication.cpp:3411
      #18 0x0000000107a58b8c in QApplication::notify(QObject*, QEvent*) at .../qtbase/src/widgets/kernel/qapplication.cpp:3361
      #19 0x000000010bc95034 in QCoreApplication::notifyInternal2(QObject*, QEvent*) at .../qtbase/src/corelib/kernel/qcoreapplication.cpp:1067
      #20 0x000000010bc95e9c in QCoreApplication::sendEvent(QObject*, QEvent*) at .../qtbase/src/corelib/kernel/qcoreapplication.cpp:1475
      #21 0x0000000107b14f20 in QWidgetRepaintManager::sendUpdateRequest(QWidget*, QWidgetRepaintManager::UpdateTime) at .../qtbase/src/widgets/kernel/qwidgetrepaintmanager.cpp:404
      #22 0x0000000107b14b54 in void QWidgetRepaintManager::markDirty<QRect>(QRect const&, QWidget*, QWidgetRepaintManager::UpdateTime, QWidgetRepaintManager::BufferState) at .../qtbase/src/widgets/kernel/qwidgetrepaintmanager.cpp:281
      #23 0x0000000107b1f6dc in QWidgetWindow::repaintWindow() at .../qtbase/src/widgets/kernel/qwidgetwindow.cpp:778
      #24 0x0000000107b1f4d0 in QWidgetWindow::handleScreenChange() at .../qtbase/src/widgets/kernel/qwidgetwindow.cpp:768
      #25 0x0000000107b1fcfc in QWidgetWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) at .../qtbase/src/widgets/Widgets_autogen/include/moc_qwidgetwindow_p.cpp:75
      #26 0x000000010bd37360 in void doActivate<false>(QObject*, int, void**) at .../qtbase/src/corelib/kernel/qobject.cpp:3924
      #27 0x000000010bd35ed4 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) at .../qtbase/src/corelib/kernel/qobject.cpp:3972
      #28 0x000000010a50460c in QWindow::screenChanged(QScreen*) at .../qtbase/src/gui/Gui_autogen/include/moc_qwindow.cpp:689
      #29 0x000000010a504530 in QWindowPrivate::emitScreenChangedRecursion(QScreen*) at .../qtbase/src/gui/kernel/qwindow.cpp:498
      #30 0x000000010a504864 in QWindowPrivate::setTopLevelScreen(QScreen*, bool) at .../qtbase/src/gui/kernel/qwindow.cpp:522
      #31 0x000000010a5092fc in QWindow::setScreen(QScreen*) at .../qtbase/src/gui/kernel/qwindow.cpp:2121
      #32 0x000000010a4f69e8 in QScreen::~QScreen() at .../qtbase/src/gui/kernel/qscreen.cpp:163
      #33 0x000000010a4f6b00 in QScreen::~QScreen() at .../qtbase/src/gui/kernel/qscreen.cpp:133
      #34 0x000000010a4f6b2c in QScreen::~QScreen() at .../qtbase/src/gui/kernel/qscreen.cpp:133
      #35 0x000000010a513684 in QWindowSystemInterface::handleScreenRemoved(QPlatformScreen*) at .../qtbase/src/gui/kernel/qwindowsysteminterface.cpp:813
      #36 0x0000000106bca204 in QCocoaScreen::remove() at .../qtbase/src/plugins/platforms/cocoa/qcocoascreen.mm:220
      #37 0x0000000106bc8a40 in QCocoaScreen::updateScreens() at .../qtbase/src/plugins/platforms/cocoa/qcocoascreen.mm:173
      #38 0x0000000106bfd2a4 in QCocoaWindow::windowDidChangeScreen() at .../qtbase/src/plugins/platforms/cocoa/qcocoawindow.mm:1359
      #39 0x0000000106c00aa8 in QCocoaWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) at .../qtbase/src/plugins/platforms/cocoa/QCocoaIntegrationPlugin_autogen/include/moc_qcocoawindow.cpp:227
      #40 0x000000010bcb6370 in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const at .../qtbase/src/corelib/kernel/qmetaobject.cpp:2390
      #41 0x0000000106b71a60 in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const at .../qtbase/src/corelib/kernel/qmetaobject.h:126
      #42 0x0000000106c01a58 in invocation function for block in qRegisterNotificationCallbacks() at .../qtbase/src/plugins/platforms/cocoa/qcocoawindow.mm:124
      #43 0x000000019a3f3130 in __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ ()
      #44 0x000000019a4873d8 in ___CFXRegistrationPost_block_invoke ()
      #45 0x000000019a487320 in _CFXRegistrationPost ()
      #46 0x000000019a3c1678 in _CFXNotificationPost ()
      #47 0x000000019b4de4e4 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
      #48 0x000000019de21a84 in __67-[NSWindow _updateSettingsSendingScreenChangeNotificationToScreen:]_block_invoke ()
      #49 0x000000019dc9e8a4 in NSPerformVisuallyAtomicChange ()
      #50 0x000000019de21888 in -[NSWindow _updateSettingsSendingScreenChangeNotificationToScreen:] ()
      #51 0x000000019df61988 in -[NSWindow _screenChanged:] ()
      #52 0x000000019df618e0 in -[NSWindow _displayChangedSoAdjustWindows:] ()
      #53 0x000000019e8d8960 in -[_NSFullScreenContentController displayChanged] ()
      #54 0x000000019e9b099c in -[_NSFullScreenSpace displayChanged] ()
      #55 0x000000019e9af678 in _fullScreenInstanceMovedSpaces ()
      #56 0x000000019fae3b40 in (anonymous namespace)::notify_datagram_handler(unsigned int, CGSDatagramType, void*, unsigned long, void*) ()
      #57 0x000000019fe82c0c in CGSDatagramReadStream::dispatchMainQueueDatagrams() ()
      #58 0x000000019fe82b08 in invocation function for block in CGSDatagramReadStream::mainQueueWakeup() ()
      #59 0x000000010545cf2c in _dispatch_call_block_and_release ()
      #60 0x000000010545eba4 in _dispatch_client_callout ()
      #61 0x0000000105471f08 in _dispatch_main_queue_drain ()
      #62 0x0000000105471aac in _dispatch_main_queue_callback_4CF ()
      #63 0x000000019a43fad4 in __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ ()
      #64 0x000000019a3fd258 in __CFRunLoopRun ()
      #65 0x000000019a3fc434 in CFRunLoopRunSpecific ()
      #66 0x00000001a4ba019c in RunCurrentEventLoopInMode ()
      #67 0x00000001a4b9ffd8 in ReceiveNextEventCommon ()
      #68 0x00000001a4b9fd30 in _BlockUntilNextEventMatchingListInModeWithFilter ()
      #69 0x000000019dc5bd68 in _DPSNextEvent ()
      #70 0x000000019e451808 in -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] ()
      #71 0x000000019dc4f09c in -[NSApplication run] ()
      #72 0x0000000106b8e5c8 in QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) at .../qtbase/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm:430
      #73 0x000000010bcab450 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) at .../qtbase/src/corelib/kernel/qeventloop.cpp:139
      #74 0x000000010bcab65c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) at .../qtbase/src/corelib/kernel/qeventloop.cpp:230
      #75 0x000000010bc95adc in QCoreApplication::exec() at .../qtbase/src/corelib/kernel/qcoreapplication.cpp:1382
      #76 0x000000010a48136c in QGuiApplication::exec() at .../qtbase/src/gui/kernel/qguiapplication.cpp:1875
      #77 0x0000000107a5611c in QApplication::exec() at .../qtbase/src/widgets/kernel/qapplication.cpp:2617
      #78 0x0000000100d2e960 in main at .../src/main.cpp:132
      

      Attachments

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

        Activity

          People

            vestbo Tor Arne Vestbø
            cyriuz Viktor Arvidsson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes