From e5a274b46756fa494df1f3a26b7425fa7ac5e588 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 18 May 2015 15:41:24 -0400 Subject: [PATCH] call XInitThreads() before creating our cef Display* object --- ports/cef/window.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ports/cef/window.rs b/ports/cef/window.rs index d2f60b04ac9..a8391c3dc37 100644 --- a/ports/cef/window.rs +++ b/ports/cef/window.rs @@ -33,7 +33,7 @@ use std::sync::mpsc::{Sender, channel}; #[cfg(target_os="linux")] extern crate x11; #[cfg(target_os="linux")] -use self::x11::xlib::XOpenDisplay; +use self::x11::xlib::{XInitThreads,XOpenDisplay}; #[cfg(target_os="linux")] pub static mut DISPLAY: *mut c_void = 0 as *mut c_void; @@ -383,7 +383,10 @@ impl CompositorProxy for CefCompositorProxy { #[cfg(target_os="linux")] pub fn init_window() { - unsafe { DISPLAY = XOpenDisplay(ptr::null()) as *mut c_void ; } + unsafe { + assert!(XInitThreads() != 0); + DISPLAY = XOpenDisplay(ptr::null()) as *mut c_void; + } } #[cfg(not(target_os="linux"))] pub fn init_window() {}