From 30aeeb6be3c20112b32909fea96ac652316c5d98 Mon Sep 17 00:00:00 2001 From: Tisfeng Date: Sun, 10 Mar 2024 22:12:25 +0800 Subject: [PATCH] perf: do not deallock main window when clicking close button (#448) --- Easydict/App/AppDelegate.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Easydict/App/AppDelegate.m b/Easydict/App/AppDelegate.m index 4de7c85f8..874737b73 100644 --- a/Easydict/App/AppDelegate.m +++ b/Easydict/App/AppDelegate.m @@ -89,9 +89,14 @@ - (void)applicationWillTerminate:(NSNotification *)aNotification { } - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)application { - [EZWindowManager.shared closeMainWindowIfNeeded]; - return NO; } +- (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag { + // Fix https://github.com/tisfeng/Easydict/issues/447 + [EZWindowManager.shared showMainWindowIfNedded]; + + return YES; +} + @end