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,16 +713,16 @@ void MainWindow::CloseDigitizers(){
if( digi == NULL) return; if( digi == NULL) return;
if(scalar && nDigiConnected > 0 ){ // scalar is child of this
scalar->close();
CleanUpScalar(); // this use digi->GetNChannels();
}
if( scope ){ if( scope ){
scope->close(); scope->close();
delete scope; delete scope;
scope = NULL; 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 ){ if( digiSetting ){
digiSetting->close(); digiSetting->close();

View File

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