qt5 - QT 5 Application Crashes With No Monitor -


i running qt desktop application on centos 6.4 qt 5 libraries.

when start application vnc, of our servers not have monitors, application crashes. starting from:

qapplication a(argc, argv); 

i have tracked down core file call qxcbconnection.cpp , 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 no monitor connected then, m_screens empty, , therefore causes "index out of bounds" error.

my question is: there way around this, or perhaps mimic monitor somehow?

you may have found regression bug in qt, don't find relevant in qt4 qt5 changelog nor in qtapplication documentation. imho should not crash , , should unnecessary work (like in qt4). can choose type of instance want create. doc gives minimal example :

qcoreapplication* createapplication(int &argc, char *argv[]) {     (int = 1; < argc; ++i)         if (!qstrcmp(argv[i], "-no-gui"))             return new qcoreapplication(argc, argv);     return new qapplication(argc, argv); }  int main(int argc, char* argv[]) {     qscopedpointer<qcoreapplication> app(createapplication(argc, argv));      if (qobject_cast<qapplication *>(app.data())) {        // start gui version...     } else {        // start non-gui version...     }      return app->exec(); } 

ps : note qapplication underwent major change behind curtains, if api didn't change much.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -