Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 1 commit into from
May 30, 2017

Conversation

cimarronm
Copy link
Contributor

…ill be active

@cimarronm
Copy link
Contributor Author

cimarronm commented May 27, 2017

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;
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

@QuLogic QuLogic left a 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
Copy link
Member

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.

Copy link
Contributor Author

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).

Copy link
Contributor Author

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

@tacaswell tacaswell requested review from efiring and mdehoon May 29, 2017 03:13
Copy link
Member

@efiring efiring left a 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.

@dstansby
Copy link
Member

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?

@efiring
Copy link
Member

efiring commented May 29, 2017

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.

@dstansby
Copy link
Member

Thanks, I can confirm the original issue and that this PR fixes the issue.

@tacaswell tacaswell merged commit eea8e4f into matplotlib:master May 30, 2017
@QuLogic QuLogic added this to the 2.1 (next point release) milestone Aug 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants