From efe9992ee34b1baf3f37d078913831f8cdcc285b Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Sat, 12 Jan 2013 19:09:23 +0800 Subject: [PATCH] If there's a messagebox to show on exit, and we *were* in fullscreen, don't try to toggle fullscreen and crash --- CHANGELOG.txt | 1 + arch/carbon/messagebox.c | 4 ++-- arch/win32/messagebox.c | 6 +++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 34d912f37..e09cd6dc1 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 -------- diff --git a/arch/carbon/messagebox.c b/arch/carbon/messagebox.c index 1cd1dbf47..161e6ee17 100644 --- a/arch/carbon/messagebox.c +++ b/arch/carbon/messagebox.c @@ -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(); } diff --git a/arch/win32/messagebox.c b/arch/win32/messagebox.c index 039048b44..f8d9d22d5 100644 --- a/arch/win32/messagebox.c +++ b/arch/win32/messagebox.c @@ -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)