Skip to content

Commit

Permalink
Fix crash when switching serial ports
Browse files Browse the repository at this point in the history
Switching port after sending a message was crashing the program
  • Loading branch information
shiftee committed Mar 6, 2018
1 parent efd0a85 commit 6ae6ec3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/rtusettingswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ void RtuSettingsWidget::changeModbusInterface(const QString& port, char parity)
{
emit connectionError( tr( "Could not connect serial port!" ) );

releaseSerialModbus();
releaseSerialModbus();
}
}
6 changes: 4 additions & 2 deletions src/serialsettingswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

SerialSettingsWidget::SerialSettingsWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::SerialSettingsWidget)
, m_serialModbus( NULL )
ui(new Ui::SerialSettingsWidget),
m_serialModbus( NULL )
{
ui->setupUi(this);
enableGuiItems(false);
Expand Down Expand Up @@ -112,6 +112,8 @@ void SerialSettingsWidget::changeSerialPort( int )
}

changeModbusInterface(port, parity);

emit serialPortActive(true);
}
else
{
Expand Down

0 comments on commit 6ae6ec3

Please sign in to comment.