- Fixed: Runtime error on Mac OS X. For whatever reason merely having the call to CFUserNotificationDisplayAlert() in I_FatalError caused exception handling to quit working. Moving it to a separate file seems to fix this. Also removed the warning about FRenderer having a non-virtual destructor.

SVN r3367 (trunk)
This commit is contained in:
Braden Obrzut 2012-02-16 22:58:17 +00:00
parent 8f516a1007
commit 449bd90121
4 changed files with 26 additions and 16 deletions

View file

@ -550,7 +550,7 @@ else( WIN32 )
sdl/sdlvideo.cpp
sdl/st_start.cpp )
if( APPLE )
set( SYSTEM_SOURCES ${SYSTEM_SOURCES} sdl/SDLMain.m sdl/iwadpicker_cocoa.mm )
set( SYSTEM_SOURCES ${SYSTEM_SOURCES} sdl/SDLMain.m sdl/iwadpicker_cocoa.mm sdl/i_system_cocoa.mm )
endif( APPLE )
endif( WIN32 )

View file

@ -19,7 +19,7 @@ struct FRenderer
Renderer = this;
}
~FRenderer()
virtual ~FRenderer()
{
Renderer = NULL;
}

View file

@ -39,7 +39,6 @@
#endif
#ifdef __APPLE__
#include <CoreFoundation/CoreFoundation.h>
#include <mach/mach_init.h>
#include <mach/semaphore.h>
#include <mach/task.h>
@ -382,6 +381,10 @@ void I_Quit (void)
extern FILE *Logfile;
bool gameisdead;
#ifdef __APPLE__
void Mac_I_FatalError(const char* errortext);
#endif
void STACK_ARGS I_FatalError (const char *error, ...)
{
static bool alreadyThrown = false;
@ -398,19 +401,7 @@ void STACK_ARGS I_FatalError (const char *error, ...)
va_end (argptr);
#ifdef __APPLE__
// Close window or exit fullscreen and release mouse capture
SDL_Quit();
const CFStringRef errorString = CFStringCreateWithCStringNoCopy( kCFAllocatorDefault,
errortext, kCFStringEncodingASCII, kCFAllocatorNull );
if ( NULL != errorString )
{
CFOptionFlags dummy;
CFUserNotificationDisplayAlert( 0, kCFUserNotificationStopAlertLevel, NULL, NULL, NULL,
CFSTR( "Error" ), errorString, CFSTR( "Exit" ), NULL, NULL, &dummy );
CFRelease( errorString );
}
Mac_I_FatalError(errortext);
#endif // __APPLE__
// Record error to log (if logging)

19
src/sdl/i_system_cocoa.mm Normal file
View file

@ -0,0 +1,19 @@
#include <CoreFoundation/CoreFoundation.h>
#include "SDL.h"
void Mac_I_FatalError(const char* errortext)
{
// Close window or exit fullscreen and release mouse capture
SDL_Quit();
const CFStringRef errorString = CFStringCreateWithCStringNoCopy( kCFAllocatorDefault,
errortext, kCFStringEncodingASCII, kCFAllocatorNull );
if ( NULL != errorString )
{
CFOptionFlags dummy;
CFUserNotificationDisplayAlert( 0, kCFUserNotificationStopAlertLevel, NULL, NULL, NULL,
CFSTR( "Fatal Error" ), errorString, CFSTR( "Exit" ), NULL, NULL, &dummy );
CFRelease( errorString );
}
}