aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2015-02-18 08:58:37 +0100
committerPierre Krieger <pierre.krieger1708@gmail.com>2015-02-18 09:00:00 +0100
commitba7f2a923f769af0d566da2397e7649f57c251f1 (patch)
treef4a90259d19b97501b11785067d3686e228b4597
parenteb330030de6d74c04b870f51351db0e67676f311 (diff)
downloadglutin-ba7f2a923f769af0d566da2397e7649f57c251f1.tar.gz
glutin-ba7f2a923f769af0d566da2397e7649f57c251f1.zip
Don't call MakeCurrent(null, null) when destroying
-rw-r--r--src/android/mod.rs3
-rw-r--r--src/win32/mod.rs3
-rw-r--r--src/x11/window/mod.rs3
3 files changed, 6 insertions, 3 deletions
diff --git a/src/android/mod.rs b/src/android/mod.rs
index 5f05300..ea93040 100644
--- a/src/android/mod.rs
+++ b/src/android/mod.rs
@@ -358,8 +358,9 @@ impl Drop for Window {
use std::ptr;
unsafe {
+ // we don't call MakeCurrent(0, 0) because we are not sure that the context
+ // is still the current one
android_glue::write_log("Destroying gl-init window");
- ffi::egl::MakeCurrent(self.display, ptr::null(), ptr::null(), ptr::null());
ffi::egl::DestroySurface(self.display, self.surface);
ffi::egl::DestroyContext(self.display, self.context);
ffi::egl::Terminate(self.display);
diff --git a/src/win32/mod.rs b/src/win32/mod.rs
index 8076bcc..e0adb7b 100644
--- a/src/win32/mod.rs
+++ b/src/win32/mod.rs
@@ -277,8 +277,9 @@ impl<'a> Iterator for WaitEventsIterator<'a> {
impl Drop for Window {
fn drop(&mut self) {
use std::ptr;
+ // we don't call MakeCurrent(0, 0) because we are not sure that the context
+ // is still the current one
unsafe { user32::PostMessageW(self.window, winapi::WM_DESTROY, 0, 0); }
- unsafe { gl::wgl::MakeCurrent(ptr::null(), ptr::null()); }
unsafe { gl::wgl::DeleteContext(self.context as *const libc::c_void); }
unsafe { user32::DestroyWindow(self.window); }
}
diff --git a/src/x11/window/mod.rs b/src/x11/window/mod.rs
index 0c501ff..05fcf14 100644
--- a/src/x11/window/mod.rs
+++ b/src/x11/window/mod.rs
@@ -59,7 +59,8 @@ unsafe impl Sync for Window {}
impl Drop for XWindow {
fn drop(&mut self) {
unsafe {
- ffi::glx::MakeCurrent(self.display, 0, ptr::null());
+ // we don't call MakeCurrent(0, 0) because we are not sure that the context
+ // is still the current one
ffi::glx::DestroyContext(self.display, self.context);
if self.is_fullscreen {