From 740ef0b225e27996dd4c209049e44075035d9d20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 1 Nov 2015 20:45:19 +0100 Subject: [PATCH] platform/glx: Check for a possible `XOpenDisplay` error Could that be the cause of https://github.com/servo/servo/issues/7931? This check should be here before anyway. I find it really extrange that this fails, but it seems to happen on the buildbots... --- src/platform/with_glx/utils.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/platform/with_glx/utils.rs b/src/platform/with_glx/utils.rs index eeada45..960ea50 100644 --- a/src/platform/with_glx/utils.rs +++ b/src/platform/with_glx/utils.rs @@ -51,9 +51,12 @@ unsafe fn get_visual_and_depth(s: *mut Screen, id: VisualID) -> Result<(*mut Vis pub fn create_offscreen_pixmap_backed_context(size: Size2D) -> Result { let dpy = unsafe { XOpenDisplay(0 as *mut c_char) }; + if dpy.is_null() { + return Err("glx::XOpenDisplay"); + } + // We try to get possible framebuffer configurations which // can be pixmap-backed and renderable - let mut attributes = [ glx::DRAWABLE_TYPE as c_int, glx::PIXMAP_BIT as c_int, glx::X_RENDERABLE as c_int, 1,