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

QFileDialog::getOpenFileName freezes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 5.15.2
    • None
    • Fedora 33 Gnome
    • Linux/X11

    Description

      If you create and destroy a QApplication object then the file dialog will freeze the application when you try to close it. I'm able to reproduce this on a brand new Fedora 33 install, but it works fine on Windows and Ubuntu. Removing the first QApplication fixes the bug too.

       

      >~"#0  0x00007ffff68a9a0f in poll () from /usr/lib64/libc.so.6\n"
      >~"#1  0x00007ffff5fc3b1e in g_main_context_iterate.constprop () from /usr/lib64/libglib-2.0.so.0\n"
      >~"#2  0x00007ffff5f7041f in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0\n"
      >~"#3  0x00007ffff70416f3 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5\n"
      >~"#4  0x00007ffff6ff357b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5\n"
      >~"#5  0x00007fffe5af43ba in QXdgDesktopPortalFileDialog::exec() () from /usr/lib64/qt5/plugins/platformthemes/libqgnomeplatform.so\n"
      >~"#6  0x00007ffff7c89ed1 in QDialog::exec() () from /usr/lib64/libQt5Widgets.so.5\n"
      >~"#7  0x00007ffff7c9c75d in QFileDialog::getOpenFileUrl(QWidget*, QString const&, QUrl const&, QString const&, QString*, QFlags<QFileDialog::Option>, QStringList const&) () from /usr/lib64/libQt5Widgets.so.5\n"
      >~"#8  0x00007ffff7c9c82c in QFileDialog::getOpenFileName(QWidget*, QString const&, QString const&, QString const&, QString*, QFlags<QFileDialog::Option>) () from /usr/lib64/libQt5Widgets.so.5\n"
      

       

      Sample code (just click on the button and then try to close the dialog):

      #include <QApplication>
      #include <QPushButton>
      #include <QFileDialog>
      
      int main(int argc, char *argv[])
      {
          {
              QApplication a(argc, argv);
          }
          QApplication a(argc, argv);
          QMainWindow w;
          w.show();
          QPushButton* b = new QPushButton;
          w.setCentralWidget(b);
          QObject::connect(b, &QPushButton::clicked, []{
              QFileDialog::getOpenFileName();
          });
          return a.exec();
      }
      
      

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            leozide Leo Zide
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes