X-Git-Url: https://vaikene.ee/gitweb/pswgen11.html?a=blobdiff_plain;ds=inline;f=src%2Fmain%2FGUI%2Fexithandler.cpp;h=0dc97ef319d6bf4e619a0bd7db7ba0751872ca09;hb=HEAD;hp=99d376f54f6a036d0035365359a03561bc539451;hpb=4d81227da330c21c7aa0badc88bd5ad4467067fb;p=evaf
diff --git a/src/main/GUI/exithandler.cpp b/src/main/GUI/exithandler.cpp
index 99d376f..0dc97ef 100644
--- a/src/main/GUI/exithandler.cpp
+++ b/src/main/GUI/exithandler.cpp
@@ -3,7 +3,7 @@
* @brief Exit handlers for the eVaf main executable
* @author Enar Vaikene
*
- * Copyright (c) 2011 Enar Vaikene
+ * Copyright (c) 2011-2019 Enar Vaikene
*
* This file is part of the eVaf C++ cross-platform application development framework.
*
@@ -24,7 +24,7 @@
#include
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
# include
#endif
@@ -36,7 +36,7 @@ namespace eVaf {
namespace GUI {
namespace Internal {
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
/**
* Signal handler on Linux
@@ -107,20 +107,19 @@ static BOOL WINAPI signalHandler(DWORD sig)
} // namespace eVaf::GUI
} // namespace eVaf
-using namespace eVaf::GUI::Internal;
-bool installExitHandler()
+bool eVaf::GUI::Internal::installExitHandler()
{
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sa.sa_handler = signalHandler;
- if (sigaction(SIGTERM, &sa, NULL) != 0) {
+ if (sigaction(SIGTERM, &sa, nullptr) != 0) {
EVAF_FATAL_ERROR("sigaction() failed: %m");
return false;
}
- if (sigaction(SIGHUP, &sa, NULL) != 0) {
+ if (sigaction(SIGHUP, &sa, nullptr) != 0) {
EVAF_FATAL_ERROR("sigaction() failed: %m");
return false;
}