From b0ed7f09a915681caa89490adc8f3eb625bbdd9c Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Wed, 23 Jun 2021 17:41:32 -0400 Subject: [PATCH] Modified the "flatten" command so that when used with "-dobox", it is not necessary that the target cell not exist. That allows a layout to be flattened into a destination in pieces. Also found that the "flatten" command never frees memory for the CellUse it creates for the copy, so fixed that as well. --- VERSION | 2 +- commands/CmdFI.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index 86c6b851..1d110651 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.181 +8.3.182 diff --git a/commands/CmdFI.c b/commands/CmdFI.c index 80bdd153..2441c3e7 100644 --- a/commands/CmdFI.c +++ b/commands/CmdFI.c @@ -2008,14 +2008,18 @@ CmdFlatten(w, cmd) return; } /* create the new def */ - if (newdef = DBCellLookDef(destname)) + newdef = DBCellLookDef(destname); + if ((newdef != NULL) && (dobox == FALSE)) { TxError("%s already exists\n",destname); return; } - newdef = DBCellNewDef(destname); - ASSERT(newdef, "CmdFlatten"); - DBCellSetAvail(newdef); + else if (newdef == NULL) + { + newdef = DBCellNewDef(destname); + ASSERT(newdef, "CmdFlatten"); + DBCellSetAvail(newdef); + } newuse = DBCellNewUse(newdef, (char *) NULL); (void) StrDup(&(newuse->cu_id), "Flattened cell"); DBSetTrans(newuse, &GeoIdentityTransform); @@ -2063,5 +2067,6 @@ CmdFlatten(w, cmd) if (xMask != CU_DESCEND_ALL) DBCellCopyAllCells(&scx, xMask, flatDestUse, (Rect *)NULL); + DBCellDeleteUse(flatDestUse); UndoEnable(); }