QT5 QApplication Crashes When There is No Monitor

  • I am running a Qt Desktop Application on CentOS 6.4 with Qt 5 Libraries.

    When I start the application from VNC/Teamviewer, as some of our servers do not have monitors, the application crashes. Starting from:

    @QApplication a(argc, argv);@

    I have tracked this down to a core file call qxcbconnection.cpp and the line:

    @xcb_create_window(m_connection, XCB_COPY_FROM_PARENT,
    m_connectionEventListener, m_screens.at(0)->root(),
    0, 0, 1, 1, 0, XCB_WINDOW_CLASS_INPUT_ONLY,
    m_screens.at(0)->screen()->root_visual, 0, 0);@

    The problem is, if there is no monitor connected, then m_screens is empty, and therefore causes an "index out of bounds" error.

    My question is: Is there a way to get around this? I have tried editing the Qt5 library files but that does nothing (acts like nothing has changed at all even when I delete the function call). I need to keep the GUI, as I log on constantly to the headless servers with vnc/teamviewer to view graphical meters and output on the GUI; and also because there are servers with monitors that it must run on graphically.

  • Moderators

    Could you please "file a bug report":https://bugreports.qt-project.org/ about this? It should really get some developer attention!

  • Thank you for the suggestion! I have just done so. "Bug Report":https://bugreports.qt-project.org/browse/QTBUG-31354

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.