From 518e01fbe86bd36e9f9a364d6b2e478e0a2899eb Mon Sep 17 00:00:00 2001 From: zicodxx Date: Wed, 26 Jan 2011 11:55:47 +0100 Subject: [PATCH] In event_process() check for wind->next before sending EVENT_WINDOW_DRAW in case drawing will free wind --- CHANGELOG.txt | 4 ++++ arch/sdl/event.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 5cc305ff1..8209a7cfa 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D2X-Rebirth Changelog +20110126 +-------- +arc/sdl/event.c: In event_process() check for wind->next before sending EVENT_WINDOW_DRAW in case drawing will free wind + 20110124 -------- main/physics.c: Revamped what previously was the BUMP_HACK by checking if an object is actually intersecting a segment and move it out towards segment center just after the initial object movement composed by fvi and before velocity is made - should make inaccurate wall collisions a bit smoother and prevent objects from goind inside or through walls, too diff --git a/arch/sdl/event.c b/arch/sdl/event.c index 6852917bd..e8b3b2a7a 100644 --- a/arch/sdl/event.c +++ b/arch/sdl/event.c @@ -148,9 +148,14 @@ void event_process(void) return; event.type = EVENT_WINDOW_DRAW; // then draw all visible windows - for (wind = window_get_first(); wind != NULL; wind = window_get_next(wind)) + wind = window_get_first(); + while (wind != NULL) + { + window *next_wind = window_get_next(wind); // check this in now in case this window closes during EVENT_WINDOW_DRAW if (window_is_visible(wind)) window_send_event(wind, &event); + wind = next_wind; + } gr_flip(); }