Quitting from dock issue with tip


#1

Hi, Jules. We just found an easily reproducible bug in the JUCE svn tip (or at least as far as revision 684).

Start up jucedemo.app.
Focus another application such as Finder.
Right-click on jucedemo icon in dock and select quit.
jucedemo.app doesn’t quit until it receives focus again.

EDIT: Forgot to mention, this is on 10.5.


#2

Thanks - I’ll check that out…


#3

We just found that it happens in other cases too. If you press the close button in your non-native titlebar, the app only closes after the mouse has been moved or a key has been hit. It also happens when quitting from the apple-menu.

The app seems to need another event before handling the quit-event.


#4

Ok - well that makes sense, because the ‘quit’ flag will only be checked each time a message is delivered. Should be easy to fix though, I think it’s just a small change in juce_mac_MessageManager.cpp:

[code]void MessageManager::stopDispatchLoop()
{
Message* const m = new Message (quitMessageId, 0, 0, 0);
m->messageRecipient = 0;
postMessageToQueue (m);
quitMessagePosted = true;

[NSApp stop: nil];

}
[/code]


#5

Sorry, that code didn’t solve the issue for me.


#6

Ok, I’ll take another look tomorrow.


#7

Any luck with this bug, Jules? Did your code fix the JUCE demo?


#8

Grab the tip and try again - I think I’ve fixed it now.


#9

I just did, but issue is still there in revision 695.


#10

That’s just not what I’m seeing here. I can’t find any problems when I try what you suggested.

Maybe try again with today’s check-in, where I made some more tweaks to the mac messagemanager locking.


#11

hmm… im still getting this bug. :frowning: (with last tip, on 10.5.7 here)
any ideas on how to fix this?

This happens differently in jucer and juce demo
juce demo : when another application is focused and you right-click->quit the application, it doesn’t quit until the application gains focus again.

jucer: when another application is focused and you right-click->quit the application, the interface closes but the icon stays on the dock until you click it.


#12

Ok, I’ve found it now. It’s very strange - seems like the NSApp object just ignores any quit messages if the app isn’t currently active. Adding this bodge seems to sort things out:

void MessageManager::stopDispatchLoop() { quitMessagePosted = true; [NSApp stop: nil]; [NSApp activateIgnoringOtherApps: YES]; }


#13

worx good now :slight_smile:

much thanks!