aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp
index fa4195ce..cf97380a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -27,11 +27,9 @@
#include <cstdlib>
#include "GpgFrontendBuildInfo.h"
-#include "gpg/GpgContext.h"
#include "gpg/GpgFunctionObject.h"
#include "ui/MainWindow.h"
#include "ui/function/CtxCheckThread.h"
-#include "ui/settings/GlobalSettingStation.h"
// Easy Logging Cpp
INITIALIZE_EASYLOGGINGPP
@@ -40,8 +38,10 @@ INITIALIZE_EASYLOGGINGPP
jmp_buf recover_env;
extern void init_logging();
+extern void init_certs();
extern void init_locale();
extern void handle_signal(int sig);
+extern void before_exit(int status, void* arg);
int main(int argc, char* argv[]) {
// Register Signals
@@ -49,6 +49,9 @@ int main(int argc, char* argv[]) {
signal(SIGFPE, handle_signal);
signal(SIGILL, handle_signal);
+ // clean something before exit
+ on_exit(before_exit, nullptr);
+
// Qt
Q_INIT_RESOURCE(gpgfrontend);
@@ -64,9 +67,12 @@ int main(int argc, char* argv[]) {
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
- // logging system
+ // config logging system
init_logging();
+ // root certs for tls connection
+ init_certs();
+
// App config
QApplication::setApplicationVersion(BUILD_VERSION);
QApplication::setApplicationName(PROJECT_NAME);
@@ -178,12 +184,12 @@ int main(int argc, char* argv[]) {
}
} else {
- QApplication::exit(RESTART_CODE);
QMessageBox::information(
nullptr, _("A serious error has occurred"),
_("Oh no! GpgFrontend caught a serious error in the software, so it "
"needs to be restarted. If the problem recurs, please manually "
"terminate the program and report the problem to the developer."));
+ QCoreApplication::quit();
return_from_event_loop_code = RESTART_CODE;
LOG(INFO) << "return_from_event_loop_code" << return_from_event_loop_code;
continue;