fix: findUse can return NULL crash
The main cause of the crash was the path for UNDO_CELL_PLACE this was trigged by performing a number of cell create/move operations (unknown exactly what sequence). Then a large number of "undo" operations. There is an ASSERT in findUse() but that does not seem built into the release (or debug CFLAGS=-g3) builds.
This commit is contained in:
parent
3638d382d6
commit
e119188f23
|
|
@ -788,9 +788,11 @@ dbUndoCellBack(up)
|
|||
break;
|
||||
case UNDO_CELL_PLACE:
|
||||
use = findUse(up, TRUE);
|
||||
DBUnLinkCell(use, up->cue_parent);
|
||||
DBDeleteCell(use);
|
||||
(void) DBCellDeleteUse(use);
|
||||
if(use) {
|
||||
DBUnLinkCell(use, up->cue_parent);
|
||||
DBDeleteCell(use);
|
||||
(void) DBCellDeleteUse(use);
|
||||
}
|
||||
DBReComputeBbox(up->cue_parent);
|
||||
DBWAreaChanged(up->cue_parent, &up->cue_bbox, DBW_ALLWINDOWS,
|
||||
(TileTypeBitMask *) NULL);
|
||||
|
|
@ -804,9 +806,11 @@ dbUndoCellBack(up)
|
|||
*/
|
||||
case UNDO_CELL_CLRID:
|
||||
use = findUse(up, FALSE); /* Find it with a NULL id */
|
||||
(void) DBReLinkCell(use, up->cue_id);
|
||||
DBWAreaChanged(up->cue_parent, &up->cue_bbox,
|
||||
(int) ~use->cu_expandMask, &DBAllButSpaceBits);
|
||||
if(use) {
|
||||
(void) DBReLinkCell(use, up->cue_id);
|
||||
DBWAreaChanged(up->cue_parent, &up->cue_bbox,
|
||||
(int) ~use->cu_expandMask, &DBAllButSpaceBits);
|
||||
}
|
||||
break;
|
||||
/*
|
||||
* The following is a hack.
|
||||
|
|
@ -817,16 +821,20 @@ dbUndoCellBack(up)
|
|||
*/
|
||||
case UNDO_CELL_SETID:
|
||||
use = findUse(up, TRUE); /* Find it with current id */
|
||||
DBUnLinkCell(use, up->cue_parent);
|
||||
freeMagic(use->cu_id);
|
||||
use->cu_id = (char *) NULL;
|
||||
if(use) {
|
||||
DBUnLinkCell(use, up->cue_parent);
|
||||
freeMagic(use->cu_id);
|
||||
use->cu_id = (char *) NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
case UNDO_CELL_LOCKDOWN:
|
||||
use = findUse(up, TRUE);
|
||||
use->cu_flags = up->cue_flags;
|
||||
DBWAreaChanged(up->cue_parent, &up->cue_bbox,
|
||||
if(use) {
|
||||
use->cu_flags = up->cue_flags;
|
||||
DBWAreaChanged(up->cue_parent, &up->cue_bbox,
|
||||
(int) ~use->cu_expandMask, &DBAllButSpaceBits);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue