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);
To copy to clipboard, switch view to plain text mode
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);
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);
To copy to clipboard, switch view to plain text mode
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 view graphical meters and output on the GUI.
Bookmarks