diff --git a/icomcommander.cpp b/icomcommander.cpp index a0d47b2..8c6d0fa 100644 --- a/icomcommander.cpp +++ b/icomcommander.cpp @@ -38,8 +38,22 @@ icomCommander::icomCommander(quint8 guid[GUIDLEN], rigCommander* parent) : rigCo icomCommander::~icomCommander() { qInfo(logRig()) << "closing instance of icomCommander()"; + queue->setRigCaps(Q_NULLPTR); // Remove access to rigCaps - closeComm(); + + qDebug(logRig()) << "Closing rig comms"; + if (comm != Q_NULLPTR) { + delete comm; + } + + if (udpHandlerThread != Q_NULLPTR) { + udpHandlerThread->quit(); + udpHandlerThread->wait(); + } + + if (ptty != Q_NULLPTR) { + delete ptty; + } } @@ -218,8 +232,6 @@ void icomCommander::commonSetup() rigCaps.commands.insert(funcTransceiverId,funcType(funcTransceiverId, QString("Transceiver ID"),QByteArrayLiteral("\x19\x00"),0,0,false,true,false)); rigCaps.commandsReverse.insert(QByteArrayLiteral("\x19\x00"),funcTransceiverId); - this->setObjectName("Icom Commander"); - queue = cachingQueue::getInstance(this); connect(queue,SIGNAL(haveCommand(funcs,QVariant,uchar)),this,SLOT(receiveCommand(funcs,QVariant,uchar))); oldScopeMode = spectModeUnknown; diff --git a/icomcommander.h b/icomcommander.h index 97df749..218628c 100644 --- a/icomcommander.h +++ b/icomcommander.h @@ -162,8 +162,6 @@ private: 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000, 100000000000 }; - cachingQueue* queue; - #ifdef DEBUG_PARSE quint64 averageParseTime=0; int numParseSamples = 0; diff --git a/rigcommander.cpp b/rigcommander.cpp index 0adaa19..3e8c0a3 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -12,14 +12,17 @@ rigCommander::rigCommander(QObject* parent) : QObject(parent) { qInfo(logRig()) << "creating instance of rigCommander()"; + queue = cachingQueue::getInstance(this); + } rigCommander::rigCommander(quint8 guid[GUIDLEN], QObject* parent) : QObject(parent) { - qInfo(logRig()) << "creating instance of rigCommander()"; + qInfo(logRig()) << "creating instance of rigCommander(guid)"; memcpy(this->guid, guid, GUIDLEN); // Add some commands that is a minimum for rig detection + queue = cachingQueue::getInstance(this); } rigCommander::~rigCommander() diff --git a/rigcommander.h b/rigcommander.h index 4a653f7..a2f53b5 100644 --- a/rigcommander.h +++ b/rigcommander.h @@ -133,6 +133,8 @@ signals: void haveReceivedValue(funcs func, QVariant value); protected: + cachingQueue* queue; + void printHex(const QByteArray &pdata); void printHex(const QByteArray &pdata, bool printVert, bool printHoriz); diff --git a/wfmain.cpp b/wfmain.cpp index 4eaa6f9..a01aa54 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -489,7 +489,6 @@ void wfmain::makeRig() rigThread = new QThread(this); rigThread->setObjectName("rigCommander()"); - // Thread: rig->moveToThread(rigThread); connect(rigThread, SIGNAL(started()), rig, SLOT(process()));