mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Handle exceptions when graphics context isn't in place.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@8519 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
deab375e4b
commit
0ac0237a1e
2 changed files with 26 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2001-01-08 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSApplication.m: exception handler - check that graphics
|
||||
context exists and if it doesn't, simply log an error
|
||||
rather than trying to rujn an alert panel.
|
||||
|
||||
2001-01-08 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSColor.m
|
||||
|
|
|
@ -71,6 +71,11 @@
|
|||
#include <AppKit/NSDataLinkPanel.h>
|
||||
#include <AppKit/NSHelpPanel.h>
|
||||
|
||||
static void
|
||||
_preventRecursion (NSException *exception)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* AppKit exception handler (overrides Foundation)
|
||||
*/
|
||||
|
@ -85,13 +90,26 @@ _NSAppKitUncaughtExceptionHandler (NSException *exception)
|
|||
#define DEBUG_BUTTON nil
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If there is no graphics context to run the alert panel in,
|
||||
* use the default exception handler.
|
||||
*/
|
||||
if (GSCurrentContext() == nil)
|
||||
{
|
||||
_NSUncaughtExceptionHandler = _preventRecursion;
|
||||
fprintf(stderr, "Uncaught exception %s, reason: %s\n",
|
||||
[[exception name] lossyCString], [[exception reason] lossyCString]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
retVal = NSRunCriticalAlertPanel([[NSProcessInfo processInfo] processName],
|
||||
@"%@: %@",
|
||||
@"Abort", @"Ignore", DEBUG_BUTTON,
|
||||
[exception name], [exception reason]);
|
||||
|
||||
if (retVal == NSAlertDefault)
|
||||
abort();
|
||||
{
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue