mirror of
https://github.com/RTimothyEdwards/magic.git
synced 2026-10-06 09:53:00 +02:00
Corrected a long-standing crash condition that happens when a
generated cell is modified multiple times. If the original cell is orphaned (no longer used anywhere in the design), it is deleted. However, an instance of the cell may exist in the secondary select buffer if the cell was previously moved or copied, and an attempt to do another move or copy will clear the secondary select buffer, encounter the deleted cell, and crash the program.
This commit is contained in:
+24
-1
@@ -224,7 +224,7 @@ DBCellDelete(cellname, force)
|
||||
{
|
||||
HashEntry *entry;
|
||||
CellDef *celldef;
|
||||
CellUse *celluse;
|
||||
CellUse *celluse, *lastuse;
|
||||
bool result;
|
||||
|
||||
entry = HashLookOnly(&dbCellDefTable, cellname);
|
||||
@@ -259,6 +259,29 @@ DBCellDelete(cellname, force)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* 2nd pass: If there are instances of the cell in */
|
||||
/* internal cells like SelectDef, etc., then remove the use */
|
||||
/* from the definition. */
|
||||
|
||||
lastuse = NULL;
|
||||
celluse = celldef->cd_parents;
|
||||
while (celluse != (CellUse *) NULL)
|
||||
{
|
||||
if (celluse->cu_parent != (CellDef *)NULL)
|
||||
{
|
||||
if ((celluse->cu_parent->cd_flags & CDINTERNAL) == CDINTERNAL)
|
||||
{
|
||||
DBDeleteCell(celluse);
|
||||
celluse = lastuse;
|
||||
}
|
||||
}
|
||||
lastuse = celluse;
|
||||
if (lastuse == NULL)
|
||||
celluse = celldef->cd_parents;
|
||||
else
|
||||
celluse = celluse->cu_nextuse;
|
||||
}
|
||||
|
||||
/* Cleared to delete. . . now prompt user if the cell has changes. */
|
||||
/* Last chance to save! */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user