diff options
Diffstat (limited to 'src/api/glx')
-rw-r--r-- | src/api/glx/mod.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/api/glx/mod.rs b/src/api/glx/mod.rs index 4ba99ca..455f6a5 100644 --- a/src/api/glx/mod.rs +++ b/src/api/glx/mod.rs @@ -182,8 +182,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); } } |