mirror of
https://github.com/RTimothyEdwards/magic.git
synced 2026-09-06 00:56:49 +02:00
Corrected the cell delete routine to include removing any elements
related to that cell (since elements are usually temporary and so kept in a separate list, not in the cell). Corrected a major error in the bplane implementation that failed to remove a cell use from the child def's parent list when deleting the use. Can cause magic to go into an infinite loop, especially after selecting and unselecting cells.
This commit is contained in:
@@ -65,6 +65,7 @@ dbInstanceUnplace(CellUse *use)
|
||||
* or else we could leave the subcell tile plane in a weird
|
||||
* state.
|
||||
*/
|
||||
|
||||
BPDelete(use->cu_parent->cd_cellPlane, use);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
||||
#include "tiles/tile.h"
|
||||
#include "database/database.h"
|
||||
#include "database/databaseInt.h"
|
||||
#include "dbwind/dbwind.h"
|
||||
#include "utils/signals.h"
|
||||
|
||||
/* Forward declarations */
|
||||
@@ -214,6 +215,9 @@ DBCellClearDef(cellDef)
|
||||
/* Remove all defined properties */
|
||||
DBPropClearAll(cellDef);
|
||||
|
||||
/* Remove any elements associated with the cell */
|
||||
DBWElementClearDef(cellDef);
|
||||
|
||||
SigEnableInterrupts();
|
||||
}
|
||||
|
||||
|
||||
+24
-1
@@ -811,7 +811,7 @@ DBClearCellPlane(def)
|
||||
/* Do not use BPDelete() inside a BPEnum loop. Use DBSrCellUses */
|
||||
/* to get a linked list of cell instances, then remove each one. */
|
||||
|
||||
DBSrCellUses(def, dbDeleteCellUse, (ClientData)NULL);
|
||||
DBSrCellUses(def, dbDeleteCellUse, (ClientData)def);
|
||||
|
||||
SigEnableInterrupts();
|
||||
}
|
||||
@@ -829,9 +829,32 @@ DBClearCellPlane(def)
|
||||
|
||||
int dbDeleteCellUse(CellUse *use, ClientData arg)
|
||||
{
|
||||
CellDef *def = (CellDef *)arg;
|
||||
CellUse *defuses, *lastuse;
|
||||
|
||||
dbInstanceUnplace(use);
|
||||
|
||||
if (UndoIsEnabled())
|
||||
DBUndoCellUse(use, UNDO_CELL_DELETE);
|
||||
|
||||
/* Remove use from cd_parents of the use's def */
|
||||
lastuse = (CellUse *)NULL;
|
||||
for (defuses = use->cu_def->cd_parents; defuses ; defuses = defuses->cu_nextuse)
|
||||
{
|
||||
if (defuses == use)
|
||||
{
|
||||
if (lastuse)
|
||||
lastuse->cu_nextuse = defuses->cu_nextuse;
|
||||
else
|
||||
use->cu_def->cd_parents = defuses->cu_nextuse;
|
||||
defuses->cu_nextuse = (CellUse *)NULL;
|
||||
break;
|
||||
}
|
||||
lastuse = defuses;
|
||||
}
|
||||
if (use->cu_id) freeMagic(use->cu_id);
|
||||
freeMagic(use);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user