some fixes
This commit is contained in:
@@ -40,10 +40,17 @@ def _install_unix_signal_handlers(app: QApplication, window: AppWindow) -> None:
|
||||
loop just long enough to deliver pending signals.
|
||||
"""
|
||||
|
||||
def _request_shutdown(*_args: object) -> None:
|
||||
def _shutdown() -> None:
|
||||
window.close()
|
||||
app.quit()
|
||||
|
||||
def _request_shutdown(signum: int, _frame: object) -> None:
|
||||
# Async-signal-safe: do the minimum from C signal context. Reset the handler
|
||||
# to default so a second signal force-terminates instead of re-entering Qt
|
||||
# teardown, then schedule the real shutdown on the next event-loop iteration.
|
||||
signal.signal(signum, signal.SIG_DFL)
|
||||
QTimer.singleShot(0, _shutdown)
|
||||
|
||||
for sig in (signal.SIGINT, signal.SIGTERM):
|
||||
signal.signal(sig, _request_shutdown)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user