some fixes

This commit is contained in:
Ayzen
2026-06-05 14:40:10 +03:00
parent 22942d9dc9
commit bbea744459
35 changed files with 1797 additions and 297 deletions
+8 -1
View File
@@ -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)