diff --git a/app/view/main/window.py b/app/view/main/window.py index 19f04caa..1748ff3b 100644 --- a/app/view/main/window.py +++ b/app/view/main/window.py @@ -1220,10 +1220,11 @@ def restart_app(self): 执行安全验证后重启程序,清理所有资源""" logger.info("正在发起重启请求...") - if self.pre_class_reset_timer.isActive(): - self.pre_class_reset_timer.stop() - - self.cleanup_shortcuts() + self._stop_pre_class_reset_timer() + self._cleanup_shortcuts() + self._stop_ipc_client() + self._close_all_windows() + self._close_main_window() # 使用 EXIT_CODE_RESTART 退出码来触发重启 # main.py 中的 handle_exit() 函数会检测此退出码并执行重启逻辑 diff --git a/main.py b/main.py index c372ea02..1ca019c3 100644 --- a/main.py +++ b/main.py @@ -186,10 +186,10 @@ def initialize_application(): wm.app_start_time = time.perf_counter() - shared_memory, is_first_instance = check_single_instance() - time.sleep(PROCESS_EXIT_WAIT_SECONDS) + shared_memory, is_first_instance = check_single_instance() + return program_dir, shared_memory, is_first_instance