diff options
author | tomaka <pierre.krieger1708@gmail.com> | 2015-01-25 12:55:58 +0100 |
---|---|---|
committer | tomaka <pierre.krieger1708@gmail.com> | 2015-01-25 12:55:58 +0100 |
commit | a2e03e7c15de276cd0f59955f92e959918f836e8 (patch) | |
tree | 67c3fd3bee5ed49ac5ee8b999cdb2ee9c96f5441 /src | |
parent | aa9262506400aee9f16efabd015e79cc116079d7 (diff) | |
parent | 56c6afd03cd739f02bc5012920d74ac06ae92ae3 (diff) | |
download | glutin-a2e03e7c15de276cd0f59955f92e959918f836e8.tar.gz glutin-a2e03e7c15de276cd0f59955f92e959918f836e8.zip |
Merge pull request #221 from tomaka/fix-rc
Fix race condition with XOpenIM
Diffstat (limited to 'src')
-rw-r--r-- | src/x11/window/mod.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/x11/window/mod.rs b/src/x11/window/mod.rs index b89e34c..91419e2 100644 --- a/src/x11/window/mod.rs +++ b/src/x11/window/mod.rs @@ -8,6 +8,7 @@ use std::sync::atomic::AtomicBool; use std::collections::RingBuf; use super::ffi; use std::sync::{Arc, Once, ONCE_INIT}; +use std::sync::{StaticMutex, MUTEX_INIT}; pub use self::monitor::{MonitorID, get_available_monitors, get_primary_monitor}; @@ -262,6 +263,10 @@ impl Window { // creating IM let im = unsafe { + // XOpenIM doesn't seem to be thread-safe + static GLOBAL_XOPENIM_LOCK: StaticMutex = MUTEX_INIT; + let _lock = GLOBAL_XOPENIM_LOCK.lock().unwrap(); + let im = ffi::XOpenIM(display, ptr::null(), ptr::null_mut(), ptr::null_mut()); if im.is_null() { return Err(OsError(format!("XOpenIM failed"))); |