Skip to content

Commit ad2c782

Browse files
committed
fix #21
1 parent d3b43be commit ad2c782

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

omodsim/formmodsim.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ FormModSim::FormModSim(int id, ModbusMultiServer& server, QSharedPointer<DataSim
6969
///
7070
FormModSim::~FormModSim()
7171
{
72-
_mbMultiServer.removeUnitMap(formId());
7372
delete ui;
7473
}
7574

@@ -94,6 +93,8 @@ void FormModSim::changeEvent(QEvent* e)
9493
///
9594
void FormModSim::closeEvent(QCloseEvent *event)
9695
{
96+
_mbMultiServer.removeUnitMap(formId());
97+
9798
emit closing();
9899
QWidget::closeEvent(event);
99100
}

omodsim/mainwindow.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,11 +1255,6 @@ void MainWindow::loadConfig(const QString& filename)
12551255
return;
12561256

12571257
ui->mdiArea->closeAllSubWindows();
1258-
for(auto&& filename: listFilename)
1259-
{
1260-
if(!filename.isEmpty())
1261-
openFile(filename);
1262-
}
12631258

12641259
auto menu = qobject_cast<MenuConnect*>(ui->actionConnect->menu());
12651260
menu->updateConnectionDetails(conns);
@@ -1269,6 +1264,12 @@ void MainWindow::loadConfig(const QString& filename)
12691264
if(menu->canConnect(cd))
12701265
_mbMultiServer.connectDevice(cd);
12711266
}
1267+
1268+
for(auto&& filename: listFilename)
1269+
{
1270+
if(!filename.isEmpty())
1271+
openFile(filename);
1272+
}
12721273
}
12731274

12741275
///

0 commit comments

Comments
 (0)