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

[Reg 6.2.8->6.5.1] [macOS] Prior modal dialog and manual event processing can break QMessageBox

XMLWordPrintable

    • macOS
    • 2c458a822 (dev), 492569fb4 (6.5), 848c01716 (6.6)

      Code

      #include <QtWidgets>
      
      int main(int argc, char **argv)
      {
          qputenv("QT_LOGGING_RULES", "qt.qpa.dialogs=true;qt.qpa.window=true;");
          QApplication app(argc, argv);
      
          QPushButton topLevel("Click me");
          topLevel.resize(100, 50);
          topLevel.show();
      
          QObject::connect(&topLevel, &QPushButton::clicked, &app, []{
              QDialog dialog;
              dialog.setModal(true); // <-- (1)
              dialog.show();
              qApp->processEvents(); // <-- (2)
              dialog.hide();         // <-- (3)
              QMessageBox::question(nullptr, "Title", "Message");
          });
      
          return app.exec();
      }
      

       

      Expected outcomes (Qt 6.5.1 on Windows; Qt 6.2.8 on macOS)
      After clicking the button, the QMessageBox stays open and awaits user selection.

       

      Actual outcomes (Qt 6.5.1 on macOS)
      After clicking the button, the QMessageBox flashes on screen momentarily and disappears without waiting for user selection.

       

      Notes

      • We get the expected outcome if we comment out any one of the 3 lines with numbered comments.
      • The customer also reports that the test app crashes in Debug mode with ASSERT failure in Q_UNREACHABLE(): "Q_UNREACHABLE was reached", file /Users/tetzlaff/Qt/Qt6.5/qtbase/src/plugins/platforms/cocoa/qcocoamessagedialog.mm, line 299 on macOS 12, Intel CPU. I am unable to reproduce this crash on macOS 13 (either Intel or ARM CPU)

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

            vhilshei Volker Hilsheimer
            skoh-qt Sze Howe Koh
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes