-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FIX: Handle properly stopping the NSApp when a tooltip panel might st… #8671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX: Handle properly stopping the NSApp when a tooltip panel might st… #8671
Conversation
Fixes an issue with the latest macosx backend code which depends on there being no windows present to stop the NSApp. It wrongly assumes that the only windows that are present would be the figure windows created but this is not the case when a tooltip is presented to the user. If a user closes the window (cmd+w, q, etc.) while the tooltip is being displayed the gui will just hang stuck in the event loop rather than quitting. |
src/_macosx.m
Outdated
@@ -664,6 +659,7 @@ static CGFloat _get_device_scale(CGContextRef cr) | |||
FigureManager_new(PyTypeObject *type, PyObject *args, PyObject *kwds) | |||
{ | |||
Window* window = [Window alloc]; | |||
++FigureWindowCount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This belongs after the early-returns, or needs to be re-decremented before returning NULL
. At the very least, this belongs after the check for invalid window
on the next line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep...moved it to later so it won't increment if there was an error and the window did not actually get created.
5ed6e2f
to
99fdbde
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems reasonable, but I can't check it and I'm not sure who to ping; maybe @mdboom?
@@ -26,13 +23,6 @@ | |||
#define COMPILING_FOR_10_10 | |||
#endif | |||
|
|||
/* Use Atsui for Mac OS X 10.4, CoreText for Mac OS X 10.5 */ | |||
#ifndef COMPILING_FOR_10_5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean we no longer support 10.4? Looks like 10.4 came out in 2005 and was last updated in 2007 and is unsupported by apple as of 2009 (all according to wikipedia https://en.wikipedia.org/wiki/Mac_OS_X_Tiger) so I think this is OK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had actually done a lot of cleanup and warning fixes to my codebase and accidentally included this. This just removes an unused ngc variable (I think it may have been used before @mdboom's conversion to agg) and the carbon include (Cocoa is already included irregardless of the OSX version earlier).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, I am planning on submitting another related patch to avoid all the deprecation warnings when compiling in 10.12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to work fine on my machine. I can reproduce the problem with 2.0.x; with this PR, the problem is solved.
I use a Mac, but I'm not entirely sure what the problem is to check that it's fixed! How do I make a tooltip appear? |
Click on the figure window to activate it, then leave your cursor over one of the toolbar icons. Then use cmd-W to close the window. |
Thanks, I can confirm the original issue and that this PR fixes the issue. |
…ill be active