Skip to content

Commit 3b72bbd

Browse files
committed
[macos] Kill autofill process not closed by macOS
1 parent 58cdd0e commit 3b72bbd

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

platforms/macos/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
include ../shared/makefiles/Makefile.sources
22

33
SOURCES_MM += $(DEPS_DIR)/nfd/nfd_cocoa.mm
4-
SOURCES_MM += fullscreen.mm
4+
SOURCES_MM += macos.mm
55
OBJECTS += $(SOURCES_MM:.mm=.o)
66
LDFLAGS += -framework AppKit -framework UniformTypeIdentifiers
77

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,20 @@ - (void)dealloc
8888
[win toggleFullScreen:nil];
8989
}
9090
}
91+
92+
// Workaround for macOS Tahoe bug: AutoFill helper processes are not terminated on app exit
93+
extern "C" void macos_kill_autofill_helpers(const char* app_name)
94+
{
95+
@autoreleasepool {
96+
NSString* appNameLower = [[NSString stringWithUTF8String:app_name] lowercaseString];
97+
98+
for (NSRunningApplication *app in [[NSWorkspace sharedWorkspace] runningApplications]) {
99+
if ([app.bundleIdentifier isEqualToString:@"com.apple.SafariPlatformSupport.Helper"]) {
100+
NSString* localizedNameLower = [[app localizedName] lowercaseString];
101+
if ([localizedNameLower hasPrefix:@"autofill"] && [localizedNameLower containsString:appNameLower]) {
102+
[app forceTerminate];
103+
}
104+
}
105+
}
106+
}
107+
}

platforms/shared/desktop/application.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ static void* macos_fullscreen_observer = NULL;
9797
static void* macos_nswindow = NULL;
9898
extern "C" void* macos_install_fullscreen_observer(void* nswindow, void(*enter_cb)(), void(*exit_cb)());
9999
extern "C" void macos_set_native_fullscreen(void* nswindow, bool enter);
100+
extern "C" void macos_kill_autofill_helpers(const char* app_name);
100101
#endif
101102

102103
int application_init(const char* rom_file, const char* symbol_file, bool force_fullscreen, bool force_windowed, int mcp_mode, int mcp_tcp_port)
@@ -187,6 +188,10 @@ void application_destroy(void)
187188
gui_destroy();
188189
sdl_destroy();
189190
single_instance_destroy();
191+
192+
#if defined(__APPLE__)
193+
macos_kill_autofill_helpers(GG_TITLE);
194+
#endif
190195
}
191196

192197
void application_mainloop(void)

0 commit comments

Comments
 (0)