If there's a messagebox to show on exit, and we *were* in fullscreen, don't try to toggle fullscreen and crash

This commit is contained in:
Chris Taylor 2013-01-12 19:09:23 +08:00
parent f6702eee8e
commit efe9992ee3
3 changed files with 8 additions and 3 deletions

View file

@ -4,6 +4,7 @@ D2X-Rebirth Changelog
--------
arch/carbon/conf.h: Use new D1XMAJORi / D1XMINORi / D1XMICROi version constants for Mac
main/inferno.h, main/mission.c, main/mission.h: Increased the maximum number of levels and secret levels per mission to 127 each, using MALLOC'd arrays; defined 'd_fname' type (mainly for my pointers to arrays of 13 character filenames, but could be convenient elsewhere)
arch/carbon/messagebox.c, arch/win32/messagebox.c: If there's a messagebox to show on exit, and we *were* in fullscreen, don't try to toggle fullscreen and crash
20130108
--------

View file

@ -29,7 +29,7 @@ void display_mac_alert(char *message, int error)
if ((wind = window_get_front()))
WINDOW_SEND_EVENT(wind, EVENT_WINDOW_DEACTIVATED);
if ((fullscreen = gr_check_fullscreen()))
if (grd_curscreen && (fullscreen = gr_check_fullscreen()))
gr_toggle_fullscreen();
osX = ( Gestalt(gestaltSystemVersion, (long *) &response) == noErr)
@ -76,7 +76,7 @@ void display_mac_alert(char *message, int error)
if ((wind = window_get_front()))
WINDOW_SEND_EVENT(wind, EVENT_WINDOW_ACTIVATED);
if (!error && fullscreen)
if (grd_curscreen && !error && fullscreen)
gr_toggle_fullscreen();
}

View file

@ -15,18 +15,22 @@ void display_win32_alert(char *message, int error)
{
d_event event;
window *wind;
int fullscreen;
// Handle Descent's windows properly
if ((wind = window_get_front()))
WINDOW_SEND_EVENT(wind, EVENT_WINDOW_DEACTIVATED);
if (gr_check_fullscreen())
if (grd_curscreen && (fullscreen = gr_check_fullscreen()))
gr_toggle_fullscreen();
MessageBox(NULL, message, error?"Sorry, a critical error has occurred.":"Attention!", error?MB_OK|MB_ICONERROR:MB_OK|MB_ICONWARNING);
if ((wind = window_get_front()))
WINDOW_SEND_EVENT(wind, EVENT_WINDOW_ACTIVATED);
if (grd_curscreen && !error && fullscreen)
gr_toggle_fullscreen();
}
void msgbox_warning(char *message)