impr: Prevent ImHex from getting stuck in an infinite crash loop
This commit is contained in:
parent
e561f49e80
commit
8f3f941600
@ -151,14 +151,30 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Window::fullFrame() {
|
void Window::fullFrame() {
|
||||||
|
static u32 crashWatchdog = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this->frameBegin();
|
this->frameBegin();
|
||||||
this->frame();
|
this->frame();
|
||||||
this->frameEnd();
|
this->frameEnd();
|
||||||
|
|
||||||
|
// Feed the watchdog
|
||||||
|
crashWatchdog = 0;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
// If an exception keeps being thrown, abort the application after 10 frames
|
||||||
|
// This is done to avoid the application getting stuck in an infinite loop of exceptions
|
||||||
|
crashWatchdog += 1;
|
||||||
|
if (crashWatchdog > 10) {
|
||||||
|
log::fatal("Crash watchdog triggered, aborting");
|
||||||
|
std::abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to recover from the exception by bringing ImGui back into a working state
|
||||||
ImGui::ErrorCheckEndFrameRecover(errorRecoverLogCallback, nullptr);
|
ImGui::ErrorCheckEndFrameRecover(errorRecoverLogCallback, nullptr);
|
||||||
ImGui::EndFrame();
|
ImGui::EndFrame();
|
||||||
ImGui::UpdatePlatformWindows();
|
ImGui::UpdatePlatformWindows();
|
||||||
|
|
||||||
|
// Handle the exception
|
||||||
handleException();
|
handleException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user