From b9a6366f96e14e396452da443b64a10ee480fabf Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 29 Dec 2014 22:56:15 +0100 Subject: Update for changes in Send/Sync traits --- src/win32/init.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/win32/init.rs') diff --git a/src/win32/init.rs b/src/win32/init.rs index 3cdf8d5..7b236b0 100644 --- a/src/win32/init.rs +++ b/src/win32/init.rs @@ -18,11 +18,15 @@ use winapi; /// receive an event for another window. thread_local!(static WINDOW: Rc)>>> = Rc::new(RefCell::new(None))); +/// Work-around the fact that HGLRC doesn't implement Send +pub struct ContextHack(pub winapi::HGLRC); +unsafe impl Send for ContextHack {} + pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: String, builder_monitor: Option, builder_gl_version: Option<(uint, uint)>, builder_debug: bool, builder_vsync: bool, builder_hidden: bool, - builder_sharelists: Option, builder_multisampling: Option) + builder_sharelists: Option, builder_multisampling: Option) -> Result { use std::mem; @@ -38,6 +42,8 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin // so we create a new thread dedicated to this window. // This is the only safe method. Using `nosend` wouldn't work for non-native runtime. ::std::thread::Thread::spawn(move || { + let builder_sharelists = builder_sharelists.map(|s| s.0); + // registering the window class let class_name = { let class_name: Vec = "Window Class".utf16_units().chain(Some(0).into_iter()) -- cgit v1.2.3