mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
GCS/connectionmanager: Trying to fix segfault reported in OP-70
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@573 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
ed7927a544
commit
38171a89c5
@ -166,6 +166,9 @@ void ConnectionManager::onConnectPressed()
|
||||
if(m_ioDev)
|
||||
{
|
||||
m_ioDev->close();
|
||||
|
||||
//delete the object created by the IConnection class
|
||||
delete m_ioDev;
|
||||
m_ioDev = NULL;
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,8 @@ public:
|
||||
|
||||
/**
|
||||
* Open a device, and return a QIODevice interface from it
|
||||
* It should be a dynamically created object as it will be
|
||||
* deleted by the connection manager.
|
||||
*/
|
||||
virtual QIODevice *openDevice(const QString &deviceName) = 0;
|
||||
|
||||
|
@ -304,11 +304,30 @@ bool RawHID::open(OpenMode mode)
|
||||
return false;
|
||||
|
||||
QIODevice::open(mode);
|
||||
|
||||
if(!m_readThread)
|
||||
m_readThread = new RawHIDReadThread(this);
|
||||
|
||||
if(!m_writeThread)
|
||||
m_writeThread = new RawHIDWriteThread(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void RawHID::close()
|
||||
{
|
||||
if(m_readThread)
|
||||
{
|
||||
delete m_readThread;
|
||||
m_readThread = NULL;
|
||||
}
|
||||
|
||||
if(m_writeThread)
|
||||
{
|
||||
delete m_writeThread;
|
||||
m_writeThread = NULL;
|
||||
}
|
||||
|
||||
dev.close(m_deviceNo);
|
||||
|
||||
QIODevice::close();
|
||||
|
Loading…
x
Reference in New Issue
Block a user