Commit 58d77a84 authored by Jeffrey Lee's avatar Jeffrey Lee

Fix CATCH_SIGNALS code to report the right error if WIMP$ScrapDir is undefined

Detail:
  c/Main - Previously the signal handling code was using a pointer to the original error block when reporting the error to the user. This could cause the wrong error to be reported in some situations (e.g. if WIMP$ScrapDir is undefined). Instead, the code now stores a copy of the error block on the stack.
Admin:
  Tested on rev A2 BB-xM


Version 2.08. Tagged as 'Paint-2_08'
parent ee21e95d
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "2.07"
Module_Version SETA 207
Module_MajorVersion SETS "2.08"
Module_Version SETA 208
Module_MinorVersion SETS ""
Module_Date SETS "12 Dec 2010"
Module_ApplicationDate SETS "12-Dec-10"
Module_Date SETS "24 Jul 2011"
Module_ApplicationDate SETS "24-Jul-11"
Module_ComponentName SETS "Paint"
Module_ComponentPath SETS "castle/RiscOS/Sources/Apps/Paint"
Module_FullVersion SETS "2.07"
Module_HelpVersion SETS "2.07 (12 Dec 2010)"
Module_FullVersion SETS "2.08"
Module_HelpVersion SETS "2.08 (24 Jul 2011)"
END
/* (2.07)
/* (2.08)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 2.07
#define Module_MajorVersion_CMHG 2.08
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 12 Dec 2010
#define Module_Date_CMHG 24 Jul 2011
#define Module_MajorVersion "2.07"
#define Module_Version 207
#define Module_MajorVersion "2.08"
#define Module_Version 208
#define Module_MinorVersion ""
#define Module_Date "12 Dec 2010"
#define Module_Date "24 Jul 2011"
#define Module_ApplicationDate "12-Dec-10"
#define Module_ApplicationDate "24-Jul-11"
#define Module_ComponentName "Paint"
#define Module_ComponentPath "castle/RiscOS/Sources/Apps/Paint"
#define Module_FullVersion "2.07"
#define Module_HelpVersion "2.07 (12 Dec 2010)"
#define Module_LibraryVersionInfo "2:7"
#define Module_FullVersion "2.08"
#define Module_HelpVersion "2.08 (24 Jul 2011)"
#define Module_LibraryVersionInfo "2:8"
......@@ -3477,20 +3477,21 @@ int main (int argc, char *argv[])
int f = 0;
BOOL reported = FALSE;
os_filestr file_str;
os_error error;
os_regset regs;
main_window *w;
_kernel_oserror *last_error;
char last_errmess [256];
_kernel_oserror error;
/*Remember the error first.*/
last_error = _kernel_last_oserror ();
_kernel_oserror *last_error = _kernel_last_oserror();
if (last_error != NULL)
strcpy (last_errmess, last_error->errmess);
memcpy (&error, last_error, sizeof(_kernel_oserror));
else
CLEAR (last_errmess);
{
error.errnum = 0;
sprintf(error.errmess,"Caught signal %d",sig); /* Should probably be sent through messagetrans, but this case shouldn't happen anyway */
}
ftracef2 ("CAUGHT SIGNAL %d!\nError was \"%s\"\n", sig, last_errmess);
ftracef2 ("CAUGHT SIGNAL %d!\nError was \"%s\"\n", sig, error.errmess);
scrap_dir = getenv ("WIMP$ScrapDir");
paint = msgs_lookup ("Pnt00");
......@@ -3502,8 +3503,6 @@ int main (int argc, char *argv[])
signal (s, Saved_Handlers [s]) == SIG_ERR))
werr (FALSE, _kernel_last_oserror ()->errmess);
error.errnum = 0;
if (scrap_dir != NULL)
for (w = main_windows; w != NULL; w = w->link)
if (w->tag == main_window_is_file && w->data->file.modified)
......@@ -3515,7 +3514,7 @@ int main (int argc, char *argv[])
regs.r[1] = (int)msgs_main_control_block ();
regs.r[2] = NULL;
regs.r[3] = 0;
regs.r[4] = (int)last_errmess;
regs.r[4] = (int)error.errmess;
regs.r[5] = (int)"<WIMP$ScrapDir>";
regs.r[6] = (int)paint;
regs.r[7] = 0;
......@@ -3548,7 +3547,7 @@ int main (int argc, char *argv[])
/*Report the error if we haven't yet.*/
if (!reported)
wimpt_complain ((os_error *) last_error);
wimpt_complain ((os_error *) &error);
return 1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment