diff --git a/Software/PC_Application/Calibration/calkit.cpp b/Software/PC_Application/Calibration/calkit.cpp index da483c6..2e19691 100644 --- a/Software/PC_Application/Calibration/calkit.cpp +++ b/Software/PC_Application/Calibration/calkit.cpp @@ -242,22 +242,14 @@ double Calkit::maxFreq() void Calkit::clearTouchstoneCache() { - if(ts_open) { - delete ts_open; - ts_open = nullptr; - } - if(ts_short) { - delete ts_short; - ts_short = nullptr; - } - if(ts_load) { - delete ts_load; - ts_load = nullptr; - } - if(ts_through) { - delete ts_through; - ts_through = nullptr; - } + delete ts_open; + ts_open = nullptr; + delete ts_short; + ts_short = nullptr; + delete ts_load; + ts_load = nullptr; + delete ts_through; + ts_through = nullptr; ts_cached = false; } diff --git a/Software/PC_Application/Device/firmwareupdatedialog.cpp b/Software/PC_Application/Device/firmwareupdatedialog.cpp index e1cfcd7..8784abb 100644 --- a/Software/PC_Application/Device/firmwareupdatedialog.cpp +++ b/Software/PC_Application/Device/firmwareupdatedialog.cpp @@ -28,9 +28,7 @@ void FirmwareUpdateDialog::on_bFile_clicked() auto filename = QFileDialog::getOpenFileName(nullptr, "Open firmware file", "", "Firmware file (*.vnafw)", nullptr, QFileDialog::DontUseNativeDialog); if (filename.length() > 0) { ui->lFile->setText(filename); - if(file) { - delete file; - } + delete file; file = new QFile(filename); ui->bStart->setEnabled(true); } diff --git a/Software/PC_Application/Traces/tracebodeplot.cpp b/Software/PC_Application/Traces/tracebodeplot.cpp index 0c91168..2efb766 100644 --- a/Software/PC_Application/Traces/tracebodeplot.cpp +++ b/Software/PC_Application/Traces/tracebodeplot.cpp @@ -352,9 +352,7 @@ void TraceBodePlot::enableTraceAxis(Trace *t, int axis, bool enabled) tracesAxis[axis].erase(t); // clean up and delete if(curves[axis].find(t) != curves[axis].end()) { - if(curves[axis][t].curve) { - delete curves[axis][t].curve; - } + delete curves[axis][t].curve; curves[axis].erase(t); } int otherAxis = axis == 0 ? 1 : 0; diff --git a/Software/PC_Application/appwindow.cpp b/Software/PC_Application/appwindow.cpp index 1857a3e..8fb1968 100644 --- a/Software/PC_Application/appwindow.cpp +++ b/Software/PC_Application/appwindow.cpp @@ -188,10 +188,8 @@ void AppWindow::ConnectToDevice(QString serial) void AppWindow::DisconnectDevice() { - if(device) { - delete device; - device = nullptr; - } + delete device; + device = nullptr; ui->actionDisconnect->setEnabled(false); ui->actionManual_Control->setEnabled(false); ui->actionFirmware_Update->setEnabled(false);