diff --git a/platform/linux/surface.rs b/platform/linux/surface.rs index 5ce3b7f..8881f88 100644 --- a/platform/linux/surface.rs +++ b/platform/linux/surface.rs @@ -42,7 +42,13 @@ impl NativePaintingGraphicsContext { #[fixed_stack_segment] pub fn from_metadata(metadata: &NativeGraphicsMetadata) -> NativePaintingGraphicsContext { unsafe { - let display = XOpenDisplay(metadata.display.to_c_str().with_ref(|c_str| c_str)); + let display = do metadata.display.with_c_str |c_str| { + XOpenDisplay(c_str) + }; + + if display.is_null() { + fail!("XOpenDisplay() failed!"); + } // FIXME(pcwalton): It would be more robust to actually have the compositor pass the // visual.