Skip to content

Commit

Permalink
Fix keyboard_interrupt for worker (#1298)
Browse files Browse the repository at this point in the history
  • Loading branch information
twizmwazin authored Jul 26, 2024
1 parent 0704b24 commit 5ab305b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions angrmanagement/logic/jobmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,12 @@ def run(self) -> None:
def keyboard_interrupt(self) -> None:
"""Called from the GUI thread when the user presses Ctrl+C or presses a cancel button"""
# lol. lmao even.
if GlobalInfo.main_window.workspace.main_instance.current_job == self:
tid = GlobalInfo.main_window.workspace.main_instance.worker_thread.ident
res = ctypes.pythonapi.PyThreadState_SetAsyncExc(ctypes.c_long(tid), ctypes.py_object(KeyboardInterrupt))
if self.ident is not None:
res = ctypes.pythonapi.PyThreadState_SetAsyncExc(
ctypes.c_long(self.ident), ctypes.py_object(KeyboardInterrupt)
)
if res != 1:
ctypes.pythonapi.PyThreadState_SetAsyncExc(ctypes.c_long(tid), 0)
ctypes.pythonapi.PyThreadState_SetAsyncExc(ctypes.c_long(self.ident), 0)
log.error("Failed to interrupt thread")


Expand Down

0 comments on commit 5ab305b

Please sign in to comment.