From f7a50c162ca4f4a4bd695acdd9f94d4286da402d Mon Sep 17 00:00:00 2001 From: Tomaka17 Date: Mon, 27 Oct 2014 13:09:36 +0100 Subject: Bugfix in swap interval for win32 --- src/win32/init.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/win32/init.rs b/src/win32/init.rs index ca99da8..5168cc6 100644 --- a/src/win32/init.rs +++ b/src/win32/init.rs @@ -350,7 +350,16 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin if builder_vsync { if extra_functions.SwapIntervalEXT.is_loaded() { unsafe { ffi::wgl::MakeCurrent(hdc, context) }; - extra_functions.SwapIntervalEXT(1); + if extra_functions.SwapIntervalEXT(1) == 0 { + tx.send(Err(format!("wglSwapIntervalEXT failed"))); + unsafe { ffi::wgl::DeleteContext(context); } + unsafe { ffi::DestroyWindow(real_window); } + return; + } + + // it is important to remove the current context, otherwise you get very weird + // errors + unsafe { ffi::wgl::MakeCurrent(ptr::null(), ptr::null()); } } } -- cgit v1.2.3