CLockObject lock(m_mutex);
if (m_communication)
{
- CLibCEC::AddLog(CEC_LOG_ERROR, "existing connection handler found");
- return bReturn;
+ CLibCEC::AddLog(CEC_LOG_WARNING, "existing connection handler found, deleting it");
+ m_communication->Close();
+ delete m_communication;
}
m_communication = new CUSBCECAdapterCommunication(this, strPort, iBaudRate);
}
if (m_communication)
+ {
m_communication->Close();
+ delete m_communication;
+ m_communication = NULL;
+ }
return NULL;
}