From a36be44c0f301de04d32b85fda6cf3e3d5288804 Mon Sep 17 00:00:00 2001 From: Michiel de Hoon Date: Sun, 22 Feb 2015 11:09:22 +0900 Subject: [PATCH] Check the number of windows remaining after closing one so that we can exit [NSApp run] after all windows have been closed. This is needed for show() to exit the run loop in non-interactive sessions. --- src/_macosx.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/_macosx.m b/src/_macosx.m index dc8d9809fb50..551dac41ec89 100644 --- a/src/_macosx.m +++ b/src/_macosx.m @@ -5241,6 +5241,16 @@ - (BOOL)closeButtonPressed return YES; } +- (void)close +{ + [super close]; + NSArray *windowsArray = [NSApp windows]; + if([windowsArray count]==0) [NSApp stop: self]; + /* This is needed for show(), which should exit from [NSApp run] + * after all windows are closed. + */ +} + - (void)dealloc { PyGILState_STATE gstate;