From d51db6e39e0c50aa2ce2f02321b32e5f22c36fdc Mon Sep 17 00:00:00 2001 From: Donny Lawrence Date: Sun, 13 Jan 2019 11:46:57 -0500 Subject: [PATCH] Fix an instance where a macOS window will stick around when trying to have it destroyed. This commit also removes an extraneous call to [_window setReleasedWhenClosed], which is already set in cocoaPandaWindow's init method. --- panda/src/cocoadisplay/cocoaGraphicsWindow.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index c3f23d4013..0a140109c7 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -711,8 +711,11 @@ close_window() { } if (_window != nil) { - [_window setReleasedWhenClosed: YES]; [_window close]; + + // Process events once more so any pending NSEvents are cleared. Not doing + // this causes the window to stick around after calling [_window close]. + process_events(); _window = nil; }