emoon / rust_minifb

Cross platfrom window and framebuffer crate for Rust
MIT License
1.01k stars 97 forks source link

Fix: winuser | DestroyWindow #230

Closed sinclairzx81 closed 3 years ago

sinclairzx81 commented 3 years ago

This PR updates the Windows winuser Drop implementation to use winuser::DestroyWindow(...) instead of winuser::CloseWindow(...). According to the docs, CloseWindow() "Minimizes (but does not destroy) the specified window.". This should allow the Window to be properly destroyed once it falls out of scope.

I have also added a small example cargo run --example drop that tests the behavior. Feel free to remove this if not needed. Have left it there in case it was helpful to quickly test this behavior across other OS.

emoon commented 3 years ago

Thanks! I think I will remove the example as it isn't really needed.