diff options
author | saturneric <[email protected]> | 2023-12-03 20:25:21 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2023-12-03 20:25:21 +0000 |
commit | 054e6e28cca2517dda2319ef683314b3318c39a6 (patch) | |
tree | ae9ff4a9fe280f3640ca249bad45ab250cfd1610 /src/app.cpp | |
parent | fix: slove issues in key/subkey generation (diff) | |
download | GpgFrontend-054e6e28cca2517dda2319ef683314b3318c39a6.tar.gz GpgFrontend-054e6e28cca2517dda2319ef683314b3318c39a6.zip |
feat: standarized and speed up app env loading process
Diffstat (limited to 'src/app.cpp')
-rw-r--r-- | src/app.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/app.cpp b/src/app.cpp index 1213aebd..8df46024 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -79,7 +79,7 @@ auto StartApplication(InitArgs args) -> int { args.argc, args.argv, true); // init the logging system for main - InitModules(args); + InitLoggingSystem(args); // change path to search for related InitGlobalPathEnv(); @@ -98,10 +98,18 @@ auto StartApplication(InitArgs args) -> int { int r = setjmp(recover_env); #endif if (!r) { - // init ui library + // should load module system first + GpgFrontend::Module::ModuleInitArgs module_init_args; + module_init_args.log_level = args.log_level; + GpgFrontend::Module::LoadGpgFrontendModules(module_init_args); + + // then load core + GpgFrontend::InitGpgFrontendCore(); + + // after that load ui library GpgFrontend::UI::InitGpgFrontendUI(app); - // create main window + // finally create main window return_from_event_loop_code = GpgFrontend::UI::RunGpgFrontendUI(app); } else { SPDLOG_ERROR("recover from a crash"); @@ -117,6 +125,16 @@ auto StartApplication(InitArgs args) -> int { return_from_event_loop_code = kCrashCode; } + SPDLOG_DEBUG("try to destroy modules system and core"); + + // first should shutdown the module system + GpgFrontend::Module::ShutdownGpgFrontendModules(); + + // then shutdown the core + GpgFrontend::DestroyGpgFrontendCore(); + + SPDLOG_DEBUG("core and modules system destroyed"); + restart_count++; SPDLOG_DEBUG("restart loop refresh, event loop code: {}, restart count: {}", @@ -125,7 +143,7 @@ auto StartApplication(InitArgs args) -> int { restart_count < 3); // close logging system - ShutdownModules(); + ShutdownLoggingSystem(); // log for debug SPDLOG_INFO("GpgFrontend is about to exit."); |