aboutsummaryrefslogtreecommitdiffstats
path: root/src/app.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-01-15 17:06:36 +0000
committersaturneric <[email protected]>2024-01-15 17:08:48 +0000
commit5af14839b718896ed8049d52ab60601ea1291db9 (patch)
tree2be9bf07932f2fd21b9759c87036f8c47345ce75 /src/app.cpp
parentrefactor: remove libicu from project (diff)
downloadGpgFrontend-5af14839b718896ed8049d52ab60601ea1291db9.tar.gz
GpgFrontend-5af14839b718896ed8049d52ab60601ea1291db9.zip
fix: remove low level api setjmp to improve corss-platform ability
Diffstat (limited to '')
-rw-r--r--src/app.cpp40
1 files changed, 5 insertions, 35 deletions
diff --git a/src/app.cpp b/src/app.cpp
index d079adb3..0aa6e5d1 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -26,8 +26,6 @@
*
*/
-#include <csetjmp>
-
#include "GpgFrontendContext.h"
#include "core/GpgConstants.h"
#include "core/GpgCoreInit.h"
@@ -37,15 +35,6 @@
// main
#include "main.h"
-/**
- * \brief Store the jump buff and make it possible to recover from a crash.
- */
-#ifdef FREEBSD
-sigjmp_buf recover_env;
-#else
-jmp_buf recover_env;
-#endif
-
namespace GpgFrontend {
constexpr int kCrashCode = ~0; ///<
@@ -80,30 +69,11 @@ auto StartApplication(const GFCxtWPtr& p_ctx) -> int {
int restart_count = 0;
do {
-#ifndef WINDOWS
- int r = sigsetjmp(recover_env, 1);
-#else
- int r = setjmp(recover_env);
-#endif
- if (!r) {
- // after that load ui totally
- GpgFrontend::UI::InitGpgFrontendUI(app);
-
- // finally create main window
- return_from_event_loop_code = GpgFrontend::UI::RunGpgFrontendUI(app);
- } else {
- GF_MAIN_LOG_ERROR("recover from a crash");
- // when signal is caught, restart the main window
- auto* message_box = new QMessageBox(
- QMessageBox::Critical, _("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."),
- QMessageBox::Ok, nullptr);
- message_box->exec();
- return_from_event_loop_code = kCrashCode;
- }
+ // after that load ui totally
+ GpgFrontend::UI::InitGpgFrontendUI(app);
+
+ // finally create main window
+ return_from_event_loop_code = GpgFrontend::UI::RunGpgFrontendUI(app);
GF_MAIN_LOG_DEBUG("try to destroy modules system and core");