Amiga: fix overview-window crashes
- MyAllocBitMap left bm->mflags uninitialized, so MyFreeBitMap took the wrong path between FreeRaster and FreeMem and intermittently corrupted exec's free list (Software Failure 0x81000005, DEADEND in FreeMem). - The NHW_OVER window is BORDERLESS, so attaching WINDOWSIZING | WINDOWDRAG | WINDOWCLOSE created phantom gadgets that hit-test against unrelated input. Pressing ESC while the overview was selected fired CLOSEWINDOW and destroyed the window underneath the running code, leading to wild-PC crashes. Drop the gadget flags; SHIFT-HELP already toggles the overview cleanly via delayed_key_action. - amii_destroy_nhwindow only reset WIN_MAP / WIN_STATUS / WIN_MESSAGE / WIN_INVEN; WIN_OVER and WIN_BASE kept pointing at freed slots, so any later 'WIN_X != WIN_ERR && amii_wins[WIN_X]->win' check dereferenced NULL. Reset them too.
This commit is contained in:
@@ -189,6 +189,7 @@ MyAllocBitMap(int xsize, int ysize, int depth, long mflags)
|
|||||||
if (!bm)
|
if (!bm)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
|
bm->mflags = mflags;
|
||||||
bm->xsize = xsize;
|
bm->xsize = xsize;
|
||||||
bm->ysize = ysize;
|
bm->ysize = ysize;
|
||||||
InitBitMap(&bm->bm, depth, xsize, ysize);
|
InitBitMap(&bm->bm, depth, xsize, ysize);
|
||||||
|
|||||||
+11
-2
@@ -227,6 +227,10 @@ amii_destroy_nhwindow(winid win) /* just hide */
|
|||||||
WIN_MESSAGE = WIN_ERR;
|
WIN_MESSAGE = WIN_ERR;
|
||||||
else if (win == WIN_INVEN)
|
else if (win == WIN_INVEN)
|
||||||
WIN_INVEN = WIN_ERR;
|
WIN_INVEN = WIN_ERR;
|
||||||
|
else if (win == WIN_OVER)
|
||||||
|
WIN_OVER = WIN_ERR;
|
||||||
|
else if (win == WIN_BASE)
|
||||||
|
WIN_BASE = WIN_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FillParams {
|
struct FillParams {
|
||||||
@@ -416,8 +420,13 @@ amii_create_nhwindow(int type)
|
|||||||
if (nw->Width >= amiIDisplay->xpix - nw->LeftEdge)
|
if (nw->Width >= amiIDisplay->xpix - nw->LeftEdge)
|
||||||
nw->Width = amiIDisplay->xpix - nw->LeftEdge;
|
nw->Width = amiIDisplay->xpix - nw->LeftEdge;
|
||||||
} else if (WINVERS_AMIV && type == NHW_OVER) {
|
} else if (WINVERS_AMIV && type == NHW_OVER) {
|
||||||
nw->Flags |= WINDOWSIZING | WINDOWDRAG | WINDOWCLOSE;
|
/* No window-system gadgets: BORDERLESS means there is no border
|
||||||
nw->IDCMPFlags |= CLOSEWINDOW;
|
* to attach close/size/drag gadgets to. On some Kickstarts the
|
||||||
|
* phantom gadgets hit-test against unrelated input (selecting
|
||||||
|
* the overview and pressing ESC has been observed to destroy
|
||||||
|
* the window and crash the game). SHIFT-HELP toggles the
|
||||||
|
* overview cleanly via delayed_key_action; that is the
|
||||||
|
* supported close path. */
|
||||||
/* Bring up window as half the width of the message window, and make
|
/* Bring up window as half the width of the message window, and make
|
||||||
* the message window change to one half the width...
|
* the message window change to one half the width...
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user