impr: Better recovery from exceptions thrown in main thread (#1577)

This PR improves many things which can be seen by the commit name, but
the most important thing is the addition of a popup telling the user
when an exception is thrown

![image](https://github.com/WerWolv/ImHex/assets/42669835/db796416-9cce-4aa5-ad60-c22f05b5fc73)
This commit is contained in:
WerWolv
2024-03-02 15:57:30 +01:00
parent 8e27eb8d36
commit 4a118b94cc
5 changed files with 74 additions and 10 deletions

View File

@@ -21,6 +21,7 @@
#include <popups/popup_question.hpp>
#include <content/popups/popup_tasks_waiting.hpp>
#include <content/popups/popup_unsaved_changes.hpp>
#include <content/popups/popup_crash_recovered.hpp>
namespace hex::plugin::builtin {
@@ -48,6 +49,10 @@ namespace hex::plugin::builtin {
void registerEventHandlers() {
static bool imhexClosing = false;
EventCrashRecovered::subscribe([](const std::exception &e) {
PopupCrashRecovered::open(e);
});
EventWindowClosing::subscribe([](GLFWwindow *window) {
imhexClosing = false;
if (ImHexApi::Provider::isDirty() && !imhexClosing) {