Skip to content

Commit 96b544c

Browse files
committed
Fixed undoEco bug
Signed-off-by: Jaehyun Kim <[email protected]>
1 parent 7adb640 commit 96b544c

File tree

6 files changed

+290
-18
lines changed

6 files changed

+290
-18
lines changed

src/odb/src/db/dbJournal.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,10 +2291,10 @@ void dbJournal::undo_connectObject()
22912291
// disconnecting the dbNet then in the journalling for
22922292
// the caller we set the mnet_id to zero.
22932293
//
2294+
assert(net_id != 0 || mnet_id != 0);
22942295
if (net_id != 0) {
22952296
iterm->disconnectDbNet();
2296-
}
2297-
if (mnet_id != 0) {
2297+
} else if (mnet_id != 0) {
22982298
iterm->disconnectDbModNet();
22992299
}
23002300
break;
@@ -2319,7 +2319,12 @@ void dbJournal::undo_connectObject()
23192319
bterm->getName(),
23202320
net_id,
23212321
mnet_id);
2322-
bterm->disconnect();
2322+
assert(net_id != 0 || mnet_id != 0);
2323+
if (net_id != 0) {
2324+
bterm->disconnectDbNet();
2325+
} else if (mnet_id != 0) {
2326+
bterm->disconnectDbModNet();
2327+
}
23232328
break;
23242329
}
23252330

src/odb/src/db/dbModBTerm.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,13 @@ void dbModBTerm::connect(dbModNet* net)
332332
if (_modbterm->_modnet == net->getId()) {
333333
return;
334334
}
335+
336+
// If the modbterm is already connected to a different modnet, disconnect it
337+
// first.
338+
if (_modbterm->_modnet != 0) {
339+
disconnect();
340+
}
341+
335342
for (auto callback : _block->_callbacks) {
336343
callback->inDbModBTermPreConnect(this, net);
337344
}

0 commit comments

Comments
 (0)