From 63d379d3a42f586b17620ac336f5e1abaa3054bb Mon Sep 17 00:00:00 2001 From: Alexander Kozlovsky Date: Fri, 18 Mar 2022 03:30:14 +0100 Subject: [PATCH] Handle OSError in TriblerWindow.clicked_force_shutdown() --- src/tribler/gui/tribler_window.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tribler/gui/tribler_window.py b/src/tribler/gui/tribler_window.py index ea83e45a1f4..2aad4489af5 100644 --- a/src/tribler/gui/tribler_window.py +++ b/src/tribler/gui/tribler_window.py @@ -51,7 +51,6 @@ from tribler.core.utilities.unicode import hexlify from tribler.core.utilities.utilities import parse_query from tribler.core.version import version_id - from tribler.gui.core_manager import CoreManager from tribler.gui.debug_window import DebugWindow from tribler.gui.defs import ( @@ -1165,7 +1164,10 @@ def clicked_force_shutdown(self): process_checker = ProcessChecker(self.root_state_dir) if process_checker.already_running: core_pid = process_checker.get_pid_from_lock_file() - os.kill(int(core_pid), 9) + try: + os.kill(int(core_pid), 9) + except OSError: # The core process can exit before the GUI process attempts to kill it + pass # Stop the Qt application QApplication.quit()