Improve Windows crash/freeze catcher UX

* Change crash log to crash dump in messages.
* Make the freeze catcher popup disappear more quickly when OpenMW thaws - we got a few freeze dumps from after a thaw.
* Improve freeze catcher message - hopefully fewer users think it's a false positive they're expected to put up with and we get future reports sooner.
This commit is contained in:
AnyOldName3 2025-04-12 18:38:55 +01:00
parent f7f148a6ca
commit deb070389f
4 changed files with 12 additions and 10 deletions

View file

@ -237,7 +237,7 @@ namespace Crash
// must remain until monitor has finished
waitMonitor();
std::string message = "OpenMW has encountered a fatal error.\nCrash log saved to '"
std::string message = "OpenMW has encountered a fatal error.\nCrash dump saved to '"
+ Misc::StringUtils::u8StringToString(getCrashDumpPath(*mShm).u8string())
+ "'.\nPlease report this to https://gitlab.com/OpenMW/openmw/issues !";
SDL_ShowSimpleMessageBox(0, "Fatal Error", message.c_str(), nullptr);

View file

@ -21,6 +21,7 @@ namespace Crash
// the main openmw process in task manager.
static constexpr const int CrashCatcherTimeout = 2500;
static constexpr const int CrashCatcherThawTimeout = 250;
struct CrashSHM;

View file

@ -87,9 +87,10 @@ namespace Crash
SetEvent(mSignalAppEvent);
}
bool CrashMonitor::waitApp() const
bool CrashMonitor::waitApp(bool thawMode) const
{
return WaitForSingleObject(mSignalMonitorEvent, CrashCatcherTimeout) == WAIT_OBJECT_0;
return WaitForSingleObject(mSignalMonitorEvent, thawMode ? CrashCatcherThawTimeout : CrashCatcherTimeout)
== WAIT_OBJECT_0;
}
bool CrashMonitor::isAppAlive() const
@ -185,7 +186,7 @@ namespace Crash
frozen = false;
}
if (!mFreezeAbort && waitApp())
if (!mFreezeAbort && waitApp(frozen))
{
shmLock();
@ -215,7 +216,7 @@ namespace Crash
{
handleCrash(true);
TerminateProcess(mAppProcessHandle, 0xDEAD);
std::string message = "OpenMW appears to have frozen.\nCrash log saved to '"
std::string message = "OpenMW has frozen.\nCrash dump saved to '"
+ Misc::StringUtils::u8StringToString(getFreezeDumpPath(*mShm).u8string())
+ "'.\nPlease report this to https://gitlab.com/OpenMW/openmw/issues !";
SDL_ShowSimpleMessageBox(0, "Fatal Error", message.c_str(), nullptr);
@ -289,10 +290,10 @@ namespace Crash
{
std::thread messageBoxThread([&]() {
SDL_MessageBoxButtonData button = { SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, 0, "Abort" };
SDL_MessageBoxData messageBoxData = { SDL_MESSAGEBOX_ERROR, nullptr, "OpenMW appears to have frozen",
"OpenMW appears to have frozen. Press Abort to terminate it and generate a crash dump.\nIf OpenMW "
"hasn't actually frozen, this message box will disappear a within a few seconds of it becoming "
"responsive.",
SDL_MessageBoxData messageBoxData = { SDL_MESSAGEBOX_ERROR, nullptr, "OpenMW has frozen",
"OpenMW has frozen. This should never happen. Press Abort to terminate it and generate a crash dump to "
"help diagnose the problem.\nOpenMW may unfreeze if you wait, and this message box will disappear "
"after it becomes responsive.",
1, &button, nullptr };
int buttonId;

View file

@ -41,7 +41,7 @@ namespace Crash
void signalApp() const;
bool waitApp() const;
bool waitApp(bool thawMode) const;
bool isAppAlive() const;