aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2015-06-17 07:19:29 +0200
committertomaka <pierre.krieger1708@gmail.com>2015-06-17 07:19:29 +0200
commit2d1e503f77434fc0dd3f2715625ce1a972fdf62f (patch)
tree30179b953121deacc87c4a5ba6072bae02f19a5a
parent4589e4a723f1de20c8fe3f5c5113d5b04762027e (diff)
parent0a1a7208c3997b167a7006dc126361388aa0eb41 (diff)
downloadglutin-2d1e503f77434fc0dd3f2715625ce1a972fdf62f.tar.gz
glutin-2d1e503f77434fc0dd3f2715625ce1a972fdf62f.zip
Merge pull request #489 from ecoal95/glx-drop
glx: Unbind the context if it's the current one
-rw-r--r--src/api/glx/mod.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/api/glx/mod.rs b/src/api/glx/mod.rs
index f1eb436..885339f 100644
--- a/src/api/glx/mod.rs
+++ b/src/api/glx/mod.rs
@@ -179,8 +179,10 @@ unsafe impl Sync for Context {}
impl Drop for Context {
fn drop(&mut self) {
unsafe {
- // we don't call MakeCurrent(0, 0) because we are not sure that the context
- // is still the current one
+ if self.is_current() {
+ self.glx.MakeCurrent(self.display as *mut _, 0, ptr::null_mut());
+ }
+
self.glx.DestroyContext(self.display as *mut _, self.context);
}
}