diff options
author | kali <kali@win> | 2021-12-14 18:18:16 +0100 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2021-12-14 18:21:32 +0100 |
commit | 5d9788388c9cf176a331d1fddc708420d88c4ce5 (patch) | |
tree | c85e59d6e63c72201d63067a82a7e6ef07603046 /gui/main.cpp | |
parent | a36b1312503d0f5d3e27bd4e296c0c9adb5e492b (diff) |
[pkg] bugfixes windows
Diffstat (limited to 'gui/main.cpp')
-rw-r--r-- | gui/main.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/gui/main.cpp b/gui/main.cpp index 976f2cd..fe96caa 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -46,13 +46,14 @@ QString getAppName(QJsonValue info, QString provider) { return "BitmaskVPN"; } -void catchUnixSignals(std::initializer_list<int> quitSignals) { - auto handler = [](int sig) -> void { - printf("\nCatched signal(%d): quitting\n", sig); - Quit(); - QApplication::quit(); - }; +auto handler = [](int sig) -> void { + printf("\nCatched signal(%d): quitting\n", sig); + Quit(); + QApplication::quit(); +}; +#ifndef OS_WIN +void catchUnixSignals(std::initializer_list<int> quitSignals) { sigset_t blocking_mask; sigemptyset(&blocking_mask); for (auto sig : quitSignals) @@ -66,6 +67,7 @@ void catchUnixSignals(std::initializer_list<int> quitSignals) { for (auto sig : quitSignals) sigaction(sig, &sa, nullptr); } +#endif int main(int argc, char **argv) { Backend backend; @@ -80,7 +82,12 @@ int main(int argc, char **argv) { app.setQuitOnLastWindowClosed(false); app.setAttribute(Qt::AA_UseHighDpiPixmaps); +#ifdef OS_WIN + signal(SIGINT, handler); + signal(SIGTERM, handler); +#else catchUnixSignals({SIGINT, SIGTERM}); +#endif /* load providers json */ QFile providerJson (":/providers.json"); |