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>
This commit is contained in:
parent
c702d683e0
commit
8c3f2a8e03
1 changed files with 12 additions and 0 deletions
|
@ -1955,6 +1955,7 @@ void BScreen::initXinerama() {
|
|||
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 @@ void BScreen::initXinerama() {
|
|||
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];
|
||||
|
|
Loading…
Reference in a new issue