fixe delete scope bug

This commit is contained in:
Ryan Tang 2023-04-25 17:36:20 -04:00
parent 3df3fd50a1
commit 8a0c828ebe
2 changed files with 8 additions and 6 deletions

View File

@ -713,17 +713,17 @@ void MainWindow::CloseDigitizers(){
if( digi == NULL) return;
if(scalar && nDigiConnected > 0 ){ // scalar is child of this
scalar->close();
CleanUpScalar(); // this use digi->GetNChannels();
}
if( scope ){
scope->close();
delete scope;
scope = NULL;
}
if(scalar && nDigiConnected > 0 ){ // scalar is child of this, This MUST after scope, because scope tell scalar to update ACQ status
scalar->close();
CleanUpScalar(); // this use digi->GetNChannels();
}
if( digiSetting ){
digiSetting->close();
delete digiSetting;

View File

@ -55,6 +55,7 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
xaxis->setTitleText("Time [ns]");
updateTraceThread = new TimingThread();
updateTraceThread->SetWaitTimeSec(0.2);
connect(updateTraceThread, &TimingThread::TimeUp, this, &Scope::UpdateScope);
//*================ add Widgets
@ -322,7 +323,7 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
}
Scope::~Scope(){
//printf("------- %s \n", __func__);
printf("------- %s \n", __func__);
StopScope();
updateTraceThread->Stop();
updateTraceThread->quit();
@ -330,6 +331,7 @@ Scope::~Scope(){
delete updateTraceThread;
for( int i = 0; i < 6; i++) delete dataTrace[i];
delete plot;
printf("------- end of %s \n", __func__);
}
void Scope::ReadScopeSettings(){