Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 99fdbde

Browse filesBrowse files
committed
FIX: Handle properly stopping the NSApp when a tooltip panel might still be active
1 parent 1144e8c commit 99fdbde
Copy full SHA for 99fdbde

File tree

Expand file treeCollapse file tree

1 file changed

+8
-12
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-12
lines changed

‎src/_macosx.m

Copy file name to clipboardExpand all lines: src/_macosx.m
+8-12Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313

1414
/* Proper way to check for the OS X version we are compiling for, from
1515
http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_development */
16-
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
17-
#define COMPILING_FOR_10_5
18-
#endif
1916
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
2017
#define COMPILING_FOR_10_6
2118
#endif
@@ -26,13 +23,6 @@
2623
#define COMPILING_FOR_10_10
2724
#endif
2825

29-
/* Use Atsui for Mac OS X 10.4, CoreText for Mac OS X 10.5 */
30-
#ifndef COMPILING_FOR_10_5
31-
static int ngc = 0; /* The number of graphics contexts in use */
32-
33-
#include <Carbon/Carbon.h>
34-
35-
#endif
3626

3727
/* CGFloat was defined in Mac OS X 10.5 */
3828
#ifndef CGFLOAT_DEFINED
@@ -44,6 +34,11 @@
4434
#define STOP_EVENT_LOOP 2
4535
#define WINDOW_CLOSING 3
4636

37+
38+
/* Keep track of number of windows present
39+
Needed to know when to stop the NSApp */
40+
static long FigureWindowCount = 0;
41+
4742
/* -------------------------- Helper function ---------------------------- */
4843

4944
static void
@@ -672,6 +667,7 @@ static CGFloat _get_device_scale(CGContextRef cr)
672667
return NULL;
673668
}
674669
self->window = window;
670+
++FigureWindowCount;
675671
return (PyObject*)self;
676672
}
677673

@@ -2022,8 +2018,8 @@ - (BOOL)closeButtonPressed
20222018
- (void)close
20232019
{
20242020
[super close];
2025-
NSArray *windowsArray = [NSApp windows];
2026-
if([windowsArray count]==0) [NSApp stop: self];
2021+
--FigureWindowCount;
2022+
if (!FigureWindowCount) [NSApp stop: self];
20272023
/* This is needed for show(), which should exit from [NSApp run]
20282024
* after all windows are closed.
20292025
*/

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.