diff --git a/NIDAQmxInterface.cpp b/NIDAQmxInterface.cpp index ab29ce8..396570f 100644 --- a/NIDAQmxInterface.cpp +++ b/NIDAQmxInterface.cpp @@ -18,6 +18,11 @@ NIDAQmxInterface::NIDAQmxInterface(QObject* parent) : QObject(parent) daq = new DAQmxEngine(); } +NIDAQmxInterface::~NIDAQmxInterface() +{ + delete daq; +} + void NIDAQmxInterface::DAQmxInitializeInterface() { /* initialize daq pointer */ @@ -305,7 +310,6 @@ int32 CVICALLBACK NIDAQmxInterface::FcnCbckDetectDI(TaskHandle taskHandle, int32 DAQmxTriggerDO(DAQ_PORT_DO_WATER, TRUE); qDebug()<<"Water reward!"; } - } /* update bit history */ diff --git a/NIDAQmxInterface.h b/NIDAQmxInterface.h index 956702e..5d0c95f 100644 --- a/NIDAQmxInterface.h +++ b/NIDAQmxInterface.h @@ -77,6 +77,7 @@ class NIDAQmxInterface: public QObject bool isPaused = false; //ignore input/output when true explicit NIDAQmxInterface(QObject *parent = 0); + ~NIDAQmxInterface(); /* function prototypes */ void DAQmxInitializeInterface(); void DAQmxDestroyInterface(); diff --git a/SocketClient.cpp b/SocketClient.cpp index 2ddae2b..24ec694 100644 --- a/SocketClient.cpp +++ b/SocketClient.cpp @@ -1,8 +1,8 @@ #include "SocketClient.h" -SocketClient::SocketClient(QWidget *parent) +SocketClient::SocketClient(QObject *parent) : QObject(parent) { - tcpSocket = new QTcpSocket(); + tcpSocket = new QTcpSocket(this); inBuffer.open(QIODevice::ReadWrite); inStream.setDevice(&inBuffer); @@ -42,6 +42,7 @@ void SocketClient::onReadData() char* data = new char[dataSize]; inStream >> data; QString fileName(data); + delete data; emit(socketFileName(fileName)); qDebug()<<"Socket: filename" << fileName; } diff --git a/SocketClient.h b/SocketClient.h index 61b44c5..45c5743 100644 --- a/SocketClient.h +++ b/SocketClient.h @@ -26,7 +26,7 @@ class SocketClient : public QObject Q_OBJECT public: - explicit SocketClient(QWidget *parent = Q_NULLPTR); + explicit SocketClient(QObject *parent = Q_NULLPTR); void connectToHost(); private slots: diff --git a/StateMachineController.cpp b/StateMachineController.cpp index 02170be..ee3177f 100644 --- a/StateMachineController.cpp +++ b/StateMachineController.cpp @@ -107,15 +107,17 @@ StateMachineController::~StateMachineController() if(logFileThread){ logFileThread->quit(); logFileThread->wait(); + delete logFileWriter; } if(socketThread){ socketThread->quit(); socketThread->wait(); + delete socketClient; } + delete timerDialog; delete nidaq; delete tdt; - delete logFileWriter; } void StateMachineController::startStateMachine(audioGameSettings settings)