(svn r7205) -Fix [FS#350, SF#1560913]: Window allocation and deletion messed with the actual window

structs inside their array, and possibly invalidating pointers higher up.
 Meaning that any function called within an wndproc could cause unknown/invalid pointers
 once control was returned to this function. Solved by the introduction of an extra
 abstraction layer, an array of z-window positions that is only concerned with the
 pointers.
This commit is contained in:
Darkvater
2006-11-18 16:47:02 +00:00
parent aa97b61a27
commit b3c48c0a84
7 changed files with 298 additions and 230 deletions

View File

@@ -194,12 +194,12 @@ void SndCopyToPool(void)
static void SndPlayScreenCoordFx(SoundFx sound, int x, int y)
{
const Window *w;
const Window* const *wz;
if (msf.effect_vol == 0) return;
for (w = _windows; w != _last_window; w++) {
const ViewPort* vp = w->viewport;
FOR_ALL_WINDOWS(wz) {
const ViewPort *vp = (*wz)->viewport;
if (vp != NULL &&
IS_INSIDE_1D(x, vp->virtual_left, vp->virtual_width) &&