From 57146ddb1bb048254260eff1245888698f4d5ce8 Mon Sep 17 00:00:00 2001 From: Henri Cook Date: Thu, 9 Jul 2026 08:28:01 +0100 Subject: [PATCH] fix(macos): force clean process exit on quit pystray's NSApplication run loop, the tkinter interpreter that is never destroyed, and the native daemon threads (websocket-client, pasteboard, aiortc) stall interpreter finalization after the tray icon stops, so the process hangs on quit and has to be force-killed. Force immediate termination with os._exit(0) once the websocket is disconnected and the single-instance lock has been released. --- ClipCascade_Desktop/src/core/application.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ClipCascade_Desktop/src/core/application.py b/ClipCascade_Desktop/src/core/application.py index 0424ca0d..1af76e6a 100644 --- a/ClipCascade_Desktop/src/core/application.py +++ b/ClipCascade_Desktop/src/core/application.py @@ -307,3 +307,8 @@ def run(self): fcntl.flock(self.lock_file, fcntl.LOCK_UN) self.lock_file.close() os.remove(self.mutex_identifier) + if PLATFORM == MACOS: + # pystray's NSApplication loop + the undestroyed tkinter interpreter + native daemon + # threads (websocket-client, pasteboard, aiortc) stall finalization; force exit instead. + logging.shutdown() + os._exit(0)