summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2010-03-12 14:38:51 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2012-11-27 13:48:44 +0000
commit5824166256c8e96c91e225f4ccb2b094b8fb045b (patch)
tree4fee93af6c2f934bdacaa1d7ceb462bbc4340596
parent6a6c3afe71ac82a93d9fd0034dd5bbdcf0eae1ea (diff)
hw/xwin: Show any fatal error message
Report the fatal error message in the dialog we pop up, rather than just referring the user to the logfile. v2: Do this a better way since the "Pass the FatalError message to OsVendorFatalError" patch has landed, and OsVendorFatalError() now gets passed the fatal error message Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
-rw-r--r--hw/xwin/winerror.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c
index 6645469fc..1318b0f36 100644
--- a/hw/xwin/winerror.c
+++ b/hw/xwin/winerror.c
@@ -59,15 +59,16 @@ OsVendorVErrorF(const char *pszFormat, va_list va_args)
#endif
/*
- * os/util.c/FatalError () calls our vendor ErrorF, so the message
- * from a FatalError will be logged. Thus, the message for the
- * fatal error is not passed to this function.
+ * os/log.c:FatalError () calls our vendor ErrorF, so the message
+ * from a FatalError will be logged.
*
* Attempt to do last-ditch, safe, important cleanup here.
*/
void
OsVendorFatalError(const char *f, va_list args)
{
+ char errormsg[1024] = "";
+
/* Don't give duplicate warning if UseMsg was called */
if (g_fSilentFatalError)
return;
@@ -78,9 +79,28 @@ OsVendorFatalError(const char *f, va_list args)
}
LogClose(EXIT_ERR_ABORT);
- winMessageBoxF("A fatal error has occurred and " PROJECT_NAME
- " will now exit.\n" "Please open %s for more information.\n",
- MB_ICONERROR, (g_pszLogFile ? g_pszLogFile : "the logfile"));
+ /* Format the error message */
+ vsnprintf(errormsg, sizeof(errormsg), f, args);
+
+ /*
+ Sometimes the error message needs a bit of cosmetic cleaning
+ up for use in a dialog box...
+ */
+ {
+ char *s;
+
+ while ((s = strstr(errormsg, "\n\t")) != NULL) {
+ s[0] = ' ';
+ s[1] = '\n';
+ }
+ }
+
+ winMessageBoxF("A fatal error has occurred and " PROJECT_NAME " will now exit.\n\n"
+ "%s\n\n"
+ "Please open %s for more information.\n",
+ MB_ICONERROR,
+ errormsg,
+ (g_pszLogFile ? g_pszLogFile : "the logfile"));
}
/*