Implement clean shutdown after receiving Unix signals, resolves #169

The database wasn't saved properly and lockfiles were not removed when receiving the signals SIGINT, SIGTERM, SIGQUIT or SIGHUP. This patch implements signal handling and performs a clean shutdown after receiving SIGINT SIGTERM or SIGQUIT and ignores SIGHUP.

Since this uses POSIX syscalls for signal and socket handling, there is no Windows implementation at the moment.
This commit is contained in:
Janek Bevendorff 2017-01-18 00:15:33 +01:00
parent 72b81bf403
commit 198691182b
No known key found for this signature in database
GPG key ID: CFEC2F6850BFFA53
3 changed files with 83 additions and 3 deletions

View file

@ -42,6 +42,7 @@ public:
public Q_SLOTS:
void openDatabase(const QString& fileName, const QString& pw = QString(),
const QString& keyFile = QString());
void appExit();
protected:
void closeEvent(QCloseEvent* event) override;
@ -68,7 +69,6 @@ private Q_SLOTS:
void applySettingsChanges();
void trayIconTriggered(QSystemTrayIcon::ActivationReason reason);
void toggleWindow();
void appExit();
void lockDatabasesAfterInactivity();
void repairDatabase();