diff options
author | Saturneric <[email protected]> | 2023-03-30 20:12:35 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2023-03-30 20:12:35 +0000 |
commit | f56cd1b41251a5c07ebedc90e8cf5858ea47a84b (patch) | |
tree | b6c4f6caec9026a94177590477d85752c86f5ed2 /src/main.cpp | |
parent | fix: solve checksum issues on windows (diff) | |
download | GpgFrontend-f56cd1b41251a5c07ebedc90e8cf5858ea47a84b.tar.gz GpgFrontend-f56cd1b41251a5c07ebedc90e8cf5858ea47a84b.zip |
fix: set application recover limit
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/main.cpp b/src/main.cpp index 98c02a0e..6b0eb727 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -126,6 +126,7 @@ int main(int argc, char* argv[]) { * with changed translation when settings change. */ int return_from_event_loop_code; + int restart_count = 0; do { do { @@ -154,16 +155,20 @@ int main(int argc, char* argv[]) { return_from_event_loop_code = CRASH_CODE; } - SPDLOG_DEBUG("restart loop refresh, event loop code: {}", - return_from_event_loop_code); - } while (return_from_event_loop_code == RESTART_CODE); + restart_count++; + + SPDLOG_DEBUG( + "restart loop refresh, event loop code: {}, restart count: {}", + return_from_event_loop_code, restart_count); + } while (return_from_event_loop_code == RESTART_CODE && restart_count < 2); if (return_from_event_loop_code == DEEP_RESTART_CODE || return_from_event_loop_code == CRASH_CODE) { // reset core GpgFrontend::ResetGpgFrontendCore(); // log for debug - SPDLOG_DEBUG("deep restart or cash loop refresh"); + SPDLOG_DEBUG("deep restart or cash loop refresh, restart count: {}", + restart_count); } else { // log for debug SPDLOG_DEBUG("need to close application, event loop code: {}", @@ -171,9 +176,9 @@ int main(int argc, char* argv[]) { } // deep restart mode - } while (return_from_event_loop_code == DEEP_RESTART_CODE || - return_from_event_loop_code == CRASH_CODE); - + } while ((return_from_event_loop_code == DEEP_RESTART_CODE || + return_from_event_loop_code == CRASH_CODE) && + restart_count < 3); // shutdown the logging system for ui GpgFrontend::UI::ShutdownUILoggingSystem(); @@ -181,8 +186,6 @@ int main(int argc, char* argv[]) { // shutdown the logging system for core GpgFrontend::ShutdownCoreLoggingSystem(); - - // log for debug SPDLOG_INFO("GpgFrontend about to exit."); |