Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanek Bevendorff <janek@jbev.net>2017-01-18 02:15:33 +0300
committerJanek Bevendorff <janek@jbev.net>2017-01-24 00:33:36 +0300
commit198691182b1cf0fbfa3664045768c3af583bbf9e (patch)
treea20b766174840548620ecf4ac3f1fcdc6dde98ab /src/gui/Application.h
parent72b81bf40345977160798a84c3b12480d3d115f2 (diff)
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.
Diffstat (limited to 'src/gui/Application.h')
-rw-r--r--src/gui/Application.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/gui/Application.h b/src/gui/Application.h
index 149b61ddf..44e03d2f8 100644
--- a/src/gui/Application.h
+++ b/src/gui/Application.h
@@ -21,6 +21,8 @@
#include <QApplication>
+class QSocketNotifier;
+
class Application : public QApplication
{
Q_OBJECT
@@ -34,8 +36,21 @@ public:
Q_SIGNALS:
void openFile(const QString& filename);
-private:
+private Q_SLOTS:
+ void quitBySignal();
+
+private:
QWidget* m_mainWindow;
+
+#if defined(Q_OS_UNIX)
+ /**
+ * Register Unix signals such as SIGINT and SIGTERM for clean shutdown.
+ */
+ void registerUnixSignals();
+ QSocketNotifier* m_unixSignalNotifier;
+ static void handleUnixSignal(int sig);
+ static int unixSignalSocket[2];
+#endif
};
#endif // KEEPASSX_APPLICATION_H