diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d2f3b2ac..85341f69e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ General Public License v2 (GPLv2). See LICENSES directory or go to ## Fixed - Prevent Back In Time crash when a plugin fails ([#2447](https://github.com/bit-team/backintime/issues/2447)) +- Prevent user from exiting the restore window while running causing backintime to freeze. (Dominic Maluski, @maluskid, [#2503](https://github.com/bit-team/backintime/issues/2503)) ## [1.6.1] (2026-02-10) diff --git a/qt/restoredialog.py b/qt/restoredialog.py index 908eda2f7..e4dc65702 100644 --- a/qt/restoredialog.py +++ b/qt/restoredialog.py @@ -106,6 +106,24 @@ def exec(self): def _slot_thread_finished(self): self._btn_close.setEnabled(True) + def closeEvent(self, event): # noqa: N802 + """ + intercept close event to prevent canceling restoration early + this provides protection against upper corner x as well as + alt-f4 key presses + """ + # Check if close button is enabled to avoid using new variable + # Could add a boolean to __init__ for easier readability + if not self._btn_close.isEnabled(): + messagebox.critical( + self, + _("A critical process is currently running. Window " + "cannot be closed until restoration is finished.") + ) + event.ignore() + else: + event.accept() + class RestoreThread(QThread): """