Deal with XineramaQueryScreens failure. The call to XineramaQueryScreens may return NULL in some cases. This patch tries to deal with that somehow. Signed-off-by: Tomas Janousek <tomi@nomi.cz>
Tomas Janousek tomi@nomi.cz
1 files changed,
12 insertions(+),
0 deletions(-)
jump to
M
src/Screen.cc
→
src/Screen.cc
@@ -1955,6 +1955,7 @@ #ifdef XINERAMA
Display *display = FbTk::App::instance()->display(); if (!XineramaIsActive(display)) { +notactive: #ifdef DEBUG cerr<<"BScreen::initXinerama(): dont have Xinerama"<<endl; #endif // DEBUG@@ -1973,6 +1974,17 @@
XineramaScreenInfo *screen_info; int number; screen_info = XineramaQueryScreens(display, &number); + + /* The call may have actually failed. If this is the first time we init + * Xinerama, fall back to turning it off. If not, pretend nothing + * happened -- another event will tell us and it will work then. */ + if (!screen_info) { + if (m_xinerama_headinfo) + return; + else + goto notactive; + } + if (m_xinerama_headinfo) delete [] m_xinerama_headinfo; m_xinerama_headinfo = new XineramaHeadInfo[number];