Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Application Hangs when Main Window Closes
Qt 6.11 is out! See what's new in the release blog

Application Hangs when Main Window Closes

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 4 Posters 1.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Brian_H
    wrote on last edited by
    #1

    Hi,

    I have a very simple dimension converting application I developed with Desktop Qt 6.8.1: Three text boxes and three labels; typing a number in one of the boxes displays that number converted to other units (e.g. inches to millimeters).
    09ef873e-e970-4571-b06f-a722ca011f72-image.png

    On a Debian 12 system, when I close the window, the process doesn't exit. Debugging shows that the QApplication destructor gets stuck waiting for a QXcbEventQueue to be destroyed, itself stuck in a call to QThread::wait. This problem doesn't seem to occur on Windows.

    The QXcbEventQueue thread itself is stuck inside a call to xcb_wait_for_event.

    The QDBusConnection thread also seems to be stuck inside a call to g_main_context_iteration.

    My main.cpp:

    #include "mainwindow.h"
    #include <QApplication>
    
    int main(int argc, char * argv[]) {
        QApplication a(argc, argv);
        MainWindow w;
        w.show();
        return a.exec();
    }
    

    and my MainWindow constructor and destructor:

    MainWindow::MainWindow(QWidget * parent)
        : QMainWindow(parent)
        , ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
        connect(ui->txtIn, SIGNAL(textEdited(QString)), this, SLOT(txtInChanged(QString)));
        connect(ui->txtMils, SIGNAL(textEdited(QString)), this, SLOT(txtMilsChanged(QString)));
        connect(ui->txtMm, SIGNAL(textEdited(QString)), this, SLOT(txtMmChanged(QString)));
    }
    
    MainWindow::~MainWindow() 
    {
        delete ui;
    }
    

    The slots are simple methods that convert the text to a number, do the math, and put the result in the other two fields.

    This smells like a deadlock, but I don't know what might be causing it.

    I happen to be running this through an X2Go remote X session, which could be part of the problem; at application startup, the message qt.qpa.xcb: X server does not support XInput 2 is emitted. I haven't had a chance to check for this issue at the physical console (display :0).

    Are there any known issues with Qt 6.8 and remote X sessions? What else might be causing this?

    JonBJ 1 Reply Last reply
    0
    • B Brian_H

      Hi,

      I have a very simple dimension converting application I developed with Desktop Qt 6.8.1: Three text boxes and three labels; typing a number in one of the boxes displays that number converted to other units (e.g. inches to millimeters).
      09ef873e-e970-4571-b06f-a722ca011f72-image.png

      On a Debian 12 system, when I close the window, the process doesn't exit. Debugging shows that the QApplication destructor gets stuck waiting for a QXcbEventQueue to be destroyed, itself stuck in a call to QThread::wait. This problem doesn't seem to occur on Windows.

      The QXcbEventQueue thread itself is stuck inside a call to xcb_wait_for_event.

      The QDBusConnection thread also seems to be stuck inside a call to g_main_context_iteration.

      My main.cpp:

      #include "mainwindow.h"
      #include <QApplication>
      
      int main(int argc, char * argv[]) {
          QApplication a(argc, argv);
          MainWindow w;
          w.show();
          return a.exec();
      }
      

      and my MainWindow constructor and destructor:

      MainWindow::MainWindow(QWidget * parent)
          : QMainWindow(parent)
          , ui(new Ui::MainWindow)
      {
          ui->setupUi(this);
          connect(ui->txtIn, SIGNAL(textEdited(QString)), this, SLOT(txtInChanged(QString)));
          connect(ui->txtMils, SIGNAL(textEdited(QString)), this, SLOT(txtMilsChanged(QString)));
          connect(ui->txtMm, SIGNAL(textEdited(QString)), this, SLOT(txtMmChanged(QString)));
      }
      
      MainWindow::~MainWindow() 
      {
          delete ui;
      }
      

      The slots are simple methods that convert the text to a number, do the math, and put the result in the other two fields.

      This smells like a deadlock, but I don't know what might be causing it.

      I happen to be running this through an X2Go remote X session, which could be part of the problem; at application startup, the message qt.qpa.xcb: X server does not support XInput 2 is emitted. I haven't had a chance to check for this issue at the physical console (display :0).

      Are there any known issues with Qt 6.8 and remote X sessions? What else might be causing this?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Brian_H
      I don't know anything about your contexts, but why do you need any widgets and connections at all? Remove them and just test with QWidget w;, works right or same issue? Then you know if it's just on exiting any Qt app.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Beside the suggestion of @JonB, are you using the Qt version provided with your distribution ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • Kent-DorfmanK Offline
          Kent-DorfmanK Offline
          Kent-Dorfman
          wrote on last edited by
          #4

          Now, for the 20,000$ question...Are you using pure X11, or running the app under xwayland?

          The dystopian literature that served as a warning in my youth has become an instruction manual in my elder years.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved