diff options
author | Saturneric <[email protected]> | 2022-01-09 20:25:12 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2022-01-09 20:25:12 +0000 |
commit | 3cff1c7d0cc46d2f10da1f7019d1478f7e0e3eaa (patch) | |
tree | d845fa4138d6ebb929116650dec3157d935520c5 /src/main.cpp | |
parent | <feature>(ui, resources): add imap folder support. (diff) | |
download | GpgFrontend-3cff1c7d0cc46d2f10da1f7019d1478f7e0e3eaa.tar.gz GpgFrontend-3cff1c7d0cc46d2f10da1f7019d1478f7e0e3eaa.zip |
<fixed>(ui): fix SIGSEGV when closing.
1. Fixed the segfault problem when closing the program (problem with root certificate).
2. Added some code that is executed before the exit function is called, including releasing all the root certificates that have been loaded.
3. Optimized the preloading code of the root certificate.
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index 3df26886..7ef2db33 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 @@ -43,6 +41,7 @@ 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 @@ -50,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); |