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

Disable 'Mirror Displays' on macOS causes all running Qt applications to crash

    XMLWordPrintable

Details

    Description

      Description

      When you disable the 'Mirror Displays' checkbox on macOS, all running Qt applications are crashing. See attached video to see Qt Creator crashing.

       

      Reproducibility

      • This issue is reproducible with Qt 5.13.1 on macOS 10.15.1

       

      Steps to reproduce

      1. Attach an external display to a Mac (tested with iMac and MacBook Pro). I used a Thunderbolt Dock and Display Port to connect the external display.
      2. Launch any Qt application on the external screen. For example Qt Creator.
      3. Open System Preferences > Displays > Arrangement
      4. Check "Mirror Displays" if it is not checked
      5. Uncheck "Mirror Displays"

      Result: All running Qt applications (for example Qt Creator) are crashing

      Qt Support has tested and confirms the crash.

       

       

      More info

       The crash occurs in QCocoaScreen::initializeScreens() in qcocoascreen.mm.

      As you can see in this code, there is no check for NULL pointer for the variable mainDisplay and cocoaScreen:

                  // Detect changes to the primary screen immediately, instead of
                  // waiting for a display reconfigure with kCGDisplaySetMainFlag.
                  // This ensures that any property updates to the other screens
                  // will be in reference to the correct primary screen.
                  QCocoaScreen *mainDisplay = QCocoaScreen::get(CGMainDisplayID());
                  if (QGuiApplication::primaryScreen()->handle() != mainDisplay) {
                      mainDisplay->updateProperties();
                      qCInfo(lcQpaScreen) << "Primary screen changed to" << mainDisplay;
                      QWindowSystemInterface::handlePrimaryScreenChanged(mainDisplay);
                  }
      
                  if (cocoaScreen == mainDisplay)
                      return; // Already reconfigured
      
                  cocoaScreen->updateProperties();
                  qCInfo(lcQpaScreen) << "Reconfigured" << cocoaScreen;
      

      If the variables mainDisplay or cocoaScreen are NULL - which is what seems to be the case when disabling "Mirror Displays" - the application is crashing.

       

       

       

      Attachments

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

        Activity

          People

            vestbo Tor Arne Vestbø
            timaccorsair Alexandre Colucci
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes