mirror of
https://github.com/rust-windowing/winit.git
synced 2026-09-01 06:10:07 -04:00
Merge pull request #280 from tomaka/win32-destroy
Don't call MakeCurrent(null, null) when destroying
This commit is contained in:
@@ -358,8 +358,9 @@ impl Drop for Window {
|
|||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
unsafe {
|
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");
|
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::DestroySurface(self.display, self.surface);
|
||||||
ffi::egl::DestroyContext(self.display, self.context);
|
ffi::egl::DestroyContext(self.display, self.context);
|
||||||
ffi::egl::Terminate(self.display);
|
ffi::egl::Terminate(self.display);
|
||||||
|
|||||||
@@ -277,8 +277,9 @@ impl<'a> Iterator for WaitEventsIterator<'a> {
|
|||||||
impl Drop for Window {
|
impl Drop for Window {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
use std::ptr;
|
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 { 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 { gl::wgl::DeleteContext(self.context as *const libc::c_void); }
|
||||||
unsafe { user32::DestroyWindow(self.window); }
|
unsafe { user32::DestroyWindow(self.window); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ unsafe impl Sync for Window {}
|
|||||||
impl Drop for XWindow {
|
impl Drop for XWindow {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
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);
|
ffi::glx::DestroyContext(self.display, self.context);
|
||||||
|
|
||||||
if self.is_fullscreen {
|
if self.is_fullscreen {
|
||||||
|
|||||||
Reference in New Issue
Block a user