diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1d3d1067e..f06020b3e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 ) diff --git a/src/r_renderer.h b/src/r_renderer.h index bc464c031..2ee63f606 100644 --- a/src/r_renderer.h +++ b/src/r_renderer.h @@ -19,7 +19,7 @@ struct FRenderer Renderer = this; } - ~FRenderer() + virtual ~FRenderer() { Renderer = NULL; } diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index 6c88a173b..f7ca515d3 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -39,7 +39,6 @@ #endif #ifdef __APPLE__ -#include #include #include #include @@ -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) diff --git a/src/sdl/i_system_cocoa.mm b/src/sdl/i_system_cocoa.mm new file mode 100644 index 000000000..50faf94a8 --- /dev/null +++ b/src/sdl/i_system_cocoa.mm @@ -0,0 +1,19 @@ +#include +#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 ); + } +}