diff --git a/serialportcommander/devicepluginserialportcommander.cpp b/serialportcommander/devicepluginserialportcommander.cpp index 0ddec3b2..71b832f2 100644 --- a/serialportcommander/devicepluginserialportcommander.cpp +++ b/serialportcommander/devicepluginserialportcommander.cpp @@ -197,7 +197,6 @@ void DevicePluginSerialPortCommander::deviceRemoved(Device *device) serialPortCommander->removeInputDevice(device); if (serialPortCommander->isEmpty()) { m_serialPortCommanders.remove(interface); - serialPortCommander->serialPort()->close(); serialPortCommander->deleteLater(); } } @@ -208,7 +207,6 @@ void DevicePluginSerialPortCommander::deviceRemoved(Device *device) serialPortCommander->removeOutputDevice(); if (serialPortCommander->isEmpty()) { m_serialPortCommanders.remove(interface); - serialPortCommander->serialPort()->close(); serialPortCommander->deleteLater(); } } diff --git a/serialportcommander/serialportcommander.cpp b/serialportcommander/serialportcommander.cpp index 7ebde253..6c3d4800 100644 --- a/serialportcommander/serialportcommander.cpp +++ b/serialportcommander/serialportcommander.cpp @@ -45,7 +45,7 @@ void SerialPortCommander::addOutputDevice(Device* device) void SerialPortCommander::removeOutputDevice() { - m_outputDevice = NULL; + m_outputDevice = nullptr; } @@ -63,7 +63,7 @@ void SerialPortCommander::removeInputDevice(Device* device) bool SerialPortCommander::isEmpty() { - return(!hasOutputDevice() || m_inputDevices.empty()); + return(!hasOutputDevice() && m_inputDevices.empty()); }