[PATCH] libxrandr: Check if getting screen for root fails

Pauli Nieminen ext-pauli.nieminen at nokia.com
Mon Jun 14 03:45:08 PDT 2010


XRRRootToScreen might return -1 if it fails to find screen for the root
window. Following code uses screen number unconditionaly to index the screen
array.

Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
---
 src/Xrandr.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/Xrandr.c b/src/Xrandr.c
index 8ab1eae..3738d61 100644
--- a/src/Xrandr.c
+++ b/src/Xrandr.c
@@ -420,6 +420,9 @@ int XRRUpdateConfiguration(XEvent *event)
 	scevent = (XRRScreenChangeNotifyEvent *) event;
 	snum = XRRRootToScreen(dpy, 
 			       ((XRRScreenChangeNotifyEvent *) event)->root);
+	if (snum < 0)
+	    return 0;
+
 	if (scevent->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
 		dpy->screens[snum].width   = scevent->height;
 		dpy->screens[snum].height  = scevent->width;
-- 
1.6.3.3



More information about the xorg-devel mailing list