Skip to content

Commit 6dd2cac

Browse files
committed
Merge branch 'better-freeze-catcher' into 'master'
Improve Windows crash/freeze catcher UX See merge request OpenMW/openmw!4630
2 parents f7f148a + deb0703 commit 6dd2cac

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

components/crashcatcher/windows_crashcatcher.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ namespace Crash
237237
// must remain until monitor has finished
238238
waitMonitor();
239239

240-
std::string message = "OpenMW has encountered a fatal error.\nCrash log saved to '"
240+
std::string message = "OpenMW has encountered a fatal error.\nCrash dump saved to '"
241241
+ Misc::StringUtils::u8StringToString(getCrashDumpPath(*mShm).u8string())
242242
+ "'.\nPlease report this to https://gitlab.com/OpenMW/openmw/issues !";
243243
SDL_ShowSimpleMessageBox(0, "Fatal Error", message.c_str(), nullptr);

components/crashcatcher/windows_crashcatcher.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ namespace Crash
2121
// the main openmw process in task manager.
2222

2323
static constexpr const int CrashCatcherTimeout = 2500;
24+
static constexpr const int CrashCatcherThawTimeout = 250;
2425

2526
struct CrashSHM;
2627

components/crashcatcher/windows_crashmonitor.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ namespace Crash
8787
SetEvent(mSignalAppEvent);
8888
}
8989

90-
bool CrashMonitor::waitApp() const
90+
bool CrashMonitor::waitApp(bool thawMode) const
9191
{
92-
return WaitForSingleObject(mSignalMonitorEvent, CrashCatcherTimeout) == WAIT_OBJECT_0;
92+
return WaitForSingleObject(mSignalMonitorEvent, thawMode ? CrashCatcherThawTimeout : CrashCatcherTimeout)
93+
== WAIT_OBJECT_0;
9394
}
9495

9596
bool CrashMonitor::isAppAlive() const
@@ -185,7 +186,7 @@ namespace Crash
185186
frozen = false;
186187
}
187188

188-
if (!mFreezeAbort && waitApp())
189+
if (!mFreezeAbort && waitApp(frozen))
189190
{
190191
shmLock();
191192

@@ -215,7 +216,7 @@ namespace Crash
215216
{
216217
handleCrash(true);
217218
TerminateProcess(mAppProcessHandle, 0xDEAD);
218-
std::string message = "OpenMW appears to have frozen.\nCrash log saved to '"
219+
std::string message = "OpenMW has frozen.\nCrash dump saved to '"
219220
+ Misc::StringUtils::u8StringToString(getFreezeDumpPath(*mShm).u8string())
220221
+ "'.\nPlease report this to https://gitlab.com/OpenMW/openmw/issues !";
221222
SDL_ShowSimpleMessageBox(0, "Fatal Error", message.c_str(), nullptr);
@@ -289,10 +290,10 @@ namespace Crash
289290
{
290291
std::thread messageBoxThread([&]() {
291292
SDL_MessageBoxButtonData button = { SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, 0, "Abort" };
292-
SDL_MessageBoxData messageBoxData = { SDL_MESSAGEBOX_ERROR, nullptr, "OpenMW appears to have frozen",
293-
"OpenMW appears to have frozen. Press Abort to terminate it and generate a crash dump.\nIf OpenMW "
294-
"hasn't actually frozen, this message box will disappear a within a few seconds of it becoming "
295-
"responsive.",
293+
SDL_MessageBoxData messageBoxData = { SDL_MESSAGEBOX_ERROR, nullptr, "OpenMW has frozen",
294+
"OpenMW has frozen. This should never happen. Press Abort to terminate it and generate a crash dump to "
295+
"help diagnose the problem.\nOpenMW may unfreeze if you wait, and this message box will disappear "
296+
"after it becomes responsive.",
296297
1, &button, nullptr };
297298

298299
int buttonId;

components/crashcatcher/windows_crashmonitor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace Crash
4141

4242
void signalApp() const;
4343

44-
bool waitApp() const;
44+
bool waitApp(bool thawMode) const;
4545

4646
bool isAppAlive() const;
4747

0 commit comments

Comments
 (0)