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

Android: Top-level modal dialog hangs on EGL when no event loop is running

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P2: Important P2: Important
    • 5.2.0
    • 5.1.0 Beta 1
    • Core: Event loop
    • None
    • Android

      Try the following app:

      #include <QtGui>
      #include <QtWidgets>
      
      class MyDialog: public QDialog
      {
      public:
          MyDialog()
          {
              createWidgets();
          }
      
      private:
          void createWidgets()
          {
              QVBoxLayout *layout = new QVBoxLayout(this);
              QPushButton *button = new QPushButton("Test", this);
              connect(button, SIGNAL(clicked()), this, SLOT(accept()));
              layout->addWidget(button);
          }
      };
      
      int main(int argc, char **argv)
      {
          QApplication app(argc, argv);
      
          MyDialog dialog;
          dialog.exec();
      }
      

      Clicking "Test" should make the dialog box close. When running on the OpenGL enabled platform plugin, it hangs instead inside the event dispatcher.

      It's easy to test the broken behavior by adding "QT += opengl" to the .pro file and running qmake && make clean && make. Then it should load the EGL back-end and you should see the bug.

      This only happens if you don't start a top level event loop first. To work around the bug in the example, you could replace the contents of the main function with the following:

      int main(int argc, char **argv)
      {
          QApplication app(argc, argv);
      
          MyDialog dialog;
          QTimer::singleShot(0, &dialog, SLOT(exec()));
          QObject::connect(&dialog, SIGNAL(accepted()), QApplication::instance(), SLOT(quit()));
      
          return app.exec();
      }
      

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

            esabraha Eskil Abrahamsen Blomfeldt
            esabraha Eskil Abrahamsen Blomfeldt
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes