From 434059d517d786078c8cf528fd8bea70aa62fb73 Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 24 Aug 2015 12:48:27 -0300 Subject: [PATCH] Don't access to the first item in DirectDraw surfaces list outside the gfx critical region This could be a fix for a long-standing crash in gfx_directx_restore_surface() accesing to an invalid memory address. --- src/allegro/src/win/wddbmpl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/allegro/src/win/wddbmpl.c b/src/allegro/src/win/wddbmpl.c index 2403fe035..2a23bd05d 100644 --- a/src/allegro/src/win/wddbmpl.c +++ b/src/allegro/src/win/wddbmpl.c @@ -113,10 +113,11 @@ void unregister_all_ddraw_surfaces(void) */ int restore_all_ddraw_surfaces(void) { - DDRAW_SURFACE *item = ddraw_surface_list; + DDRAW_SURFACE *item; _enter_gfx_critical(); + item = ddraw_surface_list; while (item) { if (gfx_directx_restore_surface(item) != 0) { _exit_gfx_critical();