aboutsummaryrefslogtreecommitdiffstats
path: root/src/init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/init.cpp b/src/init.cpp
index e1668ec5..54745d65 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -184,18 +184,30 @@ void ShutdownGlobalBasicEnv(const GFCxtWPtr &p_ctx) {
}
auto clear_gpg_password_cache =
- GlobalSettingStation::GetInstance()
- .GetSettings()
- .value("basic/clear_gpg_password_cache", false)
+ GetSettings().value("basic/clear_gpg_password_cache", false).toBool();
+
+ auto kill_all_gnupg_daemon_at_close =
+ GetSettings()
+ .value("gnupg/kill_all_gnupg_daemon_at_close", false)
.toBool();
- // clear password cache
- if (!ctx->unit_test_mode && clear_gpg_password_cache) {
- GpgAdvancedOperator::ClearGpgPasswordCache([](int, DataObjectPtr) {});
+
+ if (!ctx->unit_test_mode && kill_all_gnupg_daemon_at_close) {
+ GpgAdvancedOperator::KillAllGpgComponents(nullptr);
+ } else if (!ctx->unit_test_mode && clear_gpg_password_cache) {
+ GpgAdvancedOperator::ClearGpgPasswordCache(nullptr);
}
- Thread::TaskRunnerGetter::GetInstance().StopAllTeakRunner();
+ // first should shutdown the module system
+ GpgFrontend::Module::ShutdownGpgFrontendModules();
+
+ // then shutdown the core
+ GpgFrontend::DestroyGpgFrontendCore();
- DestroyGpgFrontendCore();
+ // deep restart mode
+ if (ctx->rtn == GpgFrontend::kDeepRestartCode ||
+ ctx->rtn == GpgFrontend::kCrashCode) {
+ QProcess::startDetached(qApp->arguments()[0], qApp->arguments());
+ };
}
} // namespace GpgFrontend