From 6ae6ec315864e17b37a100e00732365264e66865 Mon Sep 17 00:00:00 2001 From: Mark O'Donovan Date: Fri, 2 Mar 2018 16:51:32 +0000 Subject: [PATCH] Fix crash when switching serial ports Switching port after sending a message was crashing the program --- src/rtusettingswidget.cpp | 2 +- src/serialsettingswidget.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rtusettingswidget.cpp b/src/rtusettingswidget.cpp index 9103cd8..e98c9ba 100644 --- a/src/rtusettingswidget.cpp +++ b/src/rtusettingswidget.cpp @@ -26,6 +26,6 @@ void RtuSettingsWidget::changeModbusInterface(const QString& port, char parity) { emit connectionError( tr( "Could not connect serial port!" ) ); - releaseSerialModbus(); + releaseSerialModbus(); } } diff --git a/src/serialsettingswidget.cpp b/src/serialsettingswidget.cpp index 84f69cd..74d856b 100644 --- a/src/serialsettingswidget.cpp +++ b/src/serialsettingswidget.cpp @@ -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); @@ -112,6 +112,8 @@ void SerialSettingsWidget::changeSerialPort( int ) } changeModbusInterface(port, parity); + + emit serialPortActive(true); } else {