macOS: Don't override event handler for kAEQuitApplication

The implementation of the default handler, [NSApp _handleAEQuit],
does a lot more than just terminating the application, including
sending NSWorkspaceWillPowerOffNotification if appropriate, and
deals appropriately with state restoration.

Change-Id: If725838fc0f40d09a0b8885eb3e7239499d8fea0
Fixes: QTBUG-18624
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Tor Arne Vestbø 2019-10-04 15:14:56 +02:00
parent e4e3be7501
commit 35713ef3ff

View File

@ -223,10 +223,6 @@ QT_USE_NAMESPACE
application depends on.
*/
NSAppleEventManager *eventManager = [NSAppleEventManager sharedAppleEventManager];
[eventManager setEventHandler:self
andSelector:@selector(appleEventQuit:withReplyEvent:)
forEventClass:kCoreEventClass
andEventID:kAEQuitApplication];
[eventManager setEventHandler:self
andSelector:@selector(getUrl:withReplyEvent:)
forEventClass:kInternetEventClass
@ -237,7 +233,6 @@ QT_USE_NAMESPACE
- (void)removeAppleEventHandlers
{
NSAppleEventManager *eventManager = [NSAppleEventManager sharedAppleEventManager];
[eventManager removeEventHandlerForEventClass:kCoreEventClass andEventID:kAEQuitApplication];
[eventManager removeEventHandlerForEventClass:kInternetEventClass andEventID:kAEGetURL];
}
@ -360,14 +355,6 @@ QT_USE_NAMESPACE
NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
QWindowSystemInterface::handleFileOpenEvent(QUrl(QString::fromNSString(urlString)));
}
- (void)appleEventQuit:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{
Q_UNUSED(event);
Q_UNUSED(replyEvent);
[NSApp terminate:self];
}
@end
@implementation QCocoaApplicationDelegate (Menus)