From a63e906cbbfb2c99389116739335d911cb3fd331 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Tue, 17 May 2016 20:45:40 +0000 Subject: [PATCH] Do not access ui widgets after the UI has been destroyed During orderly close down the UI can be destroyed while Rx audio blocks are still being delivered. Therefore the UI pointer must be checked in MainWindow::datasink before attempting to access the UI widgets. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6683 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- mainwindow.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index dfecdd857..c7965e4a2 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -938,7 +938,7 @@ void MainWindow::dataSink(qint64 frames) QString t; m_pctZap=m_nzap*100.0/m_nsps; // TODO: this is currently redundant t.sprintf(" Rx noise: %5.1f ",m_px); - ui->signal_meter_widget->setValue(m_px); // Update thermometer + if (ui) ui->signal_meter_widget->setValue(m_px); // Update thermometer if(m_monitoring || m_diskData) { m_wideGraph->dataSink2(s,m_df3,m_ihsym,m_diskData); } @@ -976,7 +976,7 @@ void MainWindow::dataSink(qint64 frames) t.sprintf("%3d %7.1f %7.1f %7.1f %7.1f %3d",echocom_.nsum,xlevel,sigdb, dfreq,width,nqual); t=QDateTime::currentDateTimeUtc().toString("hh:mm:ss ") + t; - ui->decodedTextBrowser->appendText(t); + if (ui) ui->decodedTextBrowser->appendText(t); if(m_echoGraph->isVisible()) m_echoGraph->plotSpec(); m_nclearave=0; //Don't restart Monitor after an Echo transmission @@ -1039,12 +1039,12 @@ void MainWindow::dataSink(qint64 frames) QString t3=cmnd; int i1=cmnd.indexOf("/wsprd "); cmnd=t3.mid(0,i1+7) + t3.mid(i1+7); - ui->DecodeButton->setChecked (true); + if (ui) ui->DecodeButton->setChecked (true); p1.start(QDir::toNativeSeparators(cmnd)); - m_messageClient->status_update (m_freqNominal, m_mode, m_hisCall, - QString::number (ui->rptSpinBox->value ()), - m_modeTx, ui->autoButton->isChecked (), - m_transmitting, (m_decoderBusy = true)); + if (ui) m_messageClient->status_update (m_freqNominal, m_mode, m_hisCall, + QString::number (ui->rptSpinBox->value ()), + m_modeTx, ui->autoButton->isChecked (), + m_transmitting, (m_decoderBusy = true)); } m_rxDone=true; }