From: Mikael Magnusson Date: Sun, 5 Jul 2009 12:24:14 +0000 (+0200) Subject: Don't trust xinerama not to return NULL X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=7351d86443539fd60267baed129601d923e88269;p=chaz%2Fopenbox Don't trust xinerama not to return NULL We check that xinerama is active already, but someone got a NULL here. --- diff --git a/openbox/extensions.c b/openbox/extensions.c index cd188dd0..23d3e0c8 100644 --- a/openbox/extensions.c +++ b/openbox/extensions.c @@ -85,7 +85,11 @@ void extensions_query_all(void) void extensions_xinerama_screens(Rect **xin_areas, guint *nxin) { guint i; - gint l, r, t, b; + gint n, l, r, t, b; +#ifdef XINERAMA + XineramaScreenInfo *info; +#endif + if (ob_debug_xinerama) { gint w = WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen)); gint h = HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen)); @@ -94,12 +98,9 @@ void extensions_xinerama_screens(Rect **xin_areas, guint *nxin) RECT_SET((*xin_areas)[0], 0, 0, w/2, h); RECT_SET((*xin_areas)[1], w/2, 0, w-(w/2), h); } - else #ifdef XINERAMA - if (extensions_xinerama) { - guint i; - gint n; - XineramaScreenInfo *info = XineramaQueryScreens(ob_display, &n); + else if (extensions_xinerama && + (info = XineramaQueryScreens(ob_display, &n))) { *nxin = n; *xin_areas = g_new(Rect, *nxin + 1); for (i = 0; i < *nxin; ++i) @@ -107,8 +108,8 @@ void extensions_xinerama_screens(Rect **xin_areas, guint *nxin) info[i].width, info[i].height); XFree(info); } - else #endif + else { *nxin = 1; *xin_areas = g_new(Rect, *nxin + 1);