From 52f3618e5664232b3e8fc9052ea6c8c5343961cd Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Sat, 8 Jun 2024 15:10:26 +0200 Subject: [PATCH 1/9] Fix memleak Frees memory allocated in ChannelWebAPIUtils::getCenterFrequency(unsigned int, double&) .../sdrbase/channel/channelwebapiutils.cpp:340 --- sdrbase/channel/channelwebapiutils.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdrbase/channel/channelwebapiutils.cpp b/sdrbase/channel/channelwebapiutils.cpp index 496bc3eb6..4fb10f71a 100644 --- a/sdrbase/channel/channelwebapiutils.cpp +++ b/sdrbase/channel/channelwebapiutils.cpp @@ -338,7 +338,9 @@ bool ChannelWebAPIUtils::getCenterFrequency(unsigned int deviceIndex, double &fr if (getDeviceSettings(deviceIndex, deviceSettingsResponse, deviceSet)) { QJsonObject *jsonObj = deviceSettingsResponse.asJsonObject(); - return WebAPIUtils::getSubObjectDouble(*jsonObj, "centerFrequency", frequencyInHz); + bool result = WebAPIUtils::getSubObjectDouble(*jsonObj, "centerFrequency", frequencyInHz); + delete jsonObj; + return result; } else { From 11a672161d181d282e849c3b57bcdad27e4425ec Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Sat, 8 Jun 2024 21:20:23 +0200 Subject: [PATCH 2/9] Fix memleak Frees memory allocated in DSCDemodGUI::DSCDemodGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/demoddsc/dscdemodgui.cpp:571 --- plugins/channelrx/demoddsc/dscdemodgui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/channelrx/demoddsc/dscdemodgui.cpp b/plugins/channelrx/demoddsc/dscdemodgui.cpp index 52ea53050..2fd2c25a5 100644 --- a/plugins/channelrx/demoddsc/dscdemodgui.cpp +++ b/plugins/channelrx/demoddsc/dscdemodgui.cpp @@ -568,7 +568,7 @@ DSCDemodGUI::DSCDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999); ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenAndBlue); - ui->messages->setItemDelegateForColumn(MESSAGE_COL_RSSI, new DecimalDelegate(1)); + ui->messages->setItemDelegateForColumn(MESSAGE_COL_RSSI, new DecimalDelegate(1, ui->messages)); m_scopeVis = m_dscDemod->getScopeSink(); m_scopeVis->setGLScope(ui->glScope); From df42b3019c7cb81d0f65772254cdf29fd0da04da Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Sat, 8 Jun 2024 22:32:29 +0200 Subject: [PATCH 3/9] Fix memleak Frees memory allocated in RadiosondeDemodGUI::RadiosondeDemodGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) ...sdrangel/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp:650 in RadiosondeDemodGUI::RadiosondeDemodGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) ...sdrangel/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp:651 in RadiosondeDemodGUI::RadiosondeDemodGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) ...sdrangel/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp:652 in RadiosondeDemodGUI::RadiosondeDemodGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) ...sdrangel/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp:653 in RadiosondeDemodGUI::RadiosondeDemodGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) ...sdrangel/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp:654 in RadiosondeDemodGUI::RadiosondeDemodGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) ...sdrangel/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp:655 in RadiosondeDemodGUI::RadiosondeDemodGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) ...sdrangel/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp:656 in RadiosondeDemodGUI::RadiosondeDemodGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) ...sdrangel/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp:657 in RadiosondeDemodGUI::RadiosondeDemodGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) ...sdrangel/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp:658 in RadiosondeDemodGUI::RadiosondeDemodGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) ...sdrangel/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp:659 --- .../demodradiosonde/radiosondedemodgui.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp b/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp index 84d6f4839..178f50213 100644 --- a/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp +++ b/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp @@ -647,16 +647,16 @@ RadiosondeDemodGUI::RadiosondeDemodGUI(PluginAPI* pluginAPI, DeviceUISet *device TableTapAndHold *tableTapAndHold = new TableTapAndHold(ui->frames); connect(tableTapAndHold, &TableTapAndHold::tapAndHold, this, &RadiosondeDemodGUI::customContextMenuRequested); - ui->frames->setItemDelegateForColumn(FRAME_COL_DATE, new DateTimeDelegate("yyyy/MM/dd")); - ui->frames->setItemDelegateForColumn(FRAME_COL_TIME, new TimeDelegate()); - ui->frames->setItemDelegateForColumn(FRAME_COL_LATITUDE, new DecimalDelegate(5)); - ui->frames->setItemDelegateForColumn(FRAME_COL_LONGITUDE, new DecimalDelegate(5)); - ui->frames->setItemDelegateForColumn(FRAME_COL_ALTITUDE, new DecimalDelegate(1)); - ui->frames->setItemDelegateForColumn(FRAME_COL_SPEED, new DecimalDelegate(1)); - ui->frames->setItemDelegateForColumn(FRAME_COL_VERTICAL_RATE, new DecimalDelegate(1)); - ui->frames->setItemDelegateForColumn(FRAME_COL_HEADING, new DecimalDelegate(1)); - ui->frames->setItemDelegateForColumn(FRAME_COL_GPS_TIME, new DateTimeDelegate("yyyy/MM/dd hh:mm:ss")); - ui->frames->setItemDelegateForColumn(FRAME_COL_FREQUENCY, new DecimalDelegate(3)); + ui->frames->setItemDelegateForColumn(FRAME_COL_DATE, new DateTimeDelegate("yyyy/MM/dd", ui->frames)); + ui->frames->setItemDelegateForColumn(FRAME_COL_TIME, new TimeDelegate("hh:mm:ss", ui->frames)); + ui->frames->setItemDelegateForColumn(FRAME_COL_LATITUDE, new DecimalDelegate(5, ui->frames)); + ui->frames->setItemDelegateForColumn(FRAME_COL_LONGITUDE, new DecimalDelegate(5, ui->frames)); + ui->frames->setItemDelegateForColumn(FRAME_COL_ALTITUDE, new DecimalDelegate(1, ui->frames)); + ui->frames->setItemDelegateForColumn(FRAME_COL_SPEED, new DecimalDelegate(1, ui->frames)); + ui->frames->setItemDelegateForColumn(FRAME_COL_VERTICAL_RATE, new DecimalDelegate(1, ui->frames)); + ui->frames->setItemDelegateForColumn(FRAME_COL_HEADING, new DecimalDelegate(1, ui->frames)); + ui->frames->setItemDelegateForColumn(FRAME_COL_GPS_TIME, new DateTimeDelegate("yyyy/MM/dd hh:mm:ss", ui->frames)); + ui->frames->setItemDelegateForColumn(FRAME_COL_FREQUENCY, new DecimalDelegate(3, ui->frames)); ui->scopeContainer->setVisible(false); From 79db899dff2ee1f1cf56d0d20e16527c5ef25bba Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Sat, 8 Jun 2024 22:55:08 +0200 Subject: [PATCH 4/9] Fix memleaks Frees memory allocated in NavtexDemodGUI::NavtexDemodGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) ...sdrangel/plugins/channelrx/demodnavtex/navtexdemodgui.cpp:528 in NavtexDemodGUI::NavtexDemodGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) ...sdrangel/plugins/channelrx/demodnavtex/navtexdemodgui.cpp:529 --- plugins/channelrx/demodnavtex/navtexdemodgui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/channelrx/demodnavtex/navtexdemodgui.cpp b/plugins/channelrx/demodnavtex/navtexdemodgui.cpp index 2c71eb467..dbf3d7127 100644 --- a/plugins/channelrx/demodnavtex/navtexdemodgui.cpp +++ b/plugins/channelrx/demodnavtex/navtexdemodgui.cpp @@ -525,8 +525,8 @@ NavtexDemodGUI::NavtexDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, B ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999); ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenAndBlue); - ui->messages->setItemDelegateForColumn(MESSAGE_COL_ERROR_PERCENT, new DecimalDelegate(1)); - ui->messages->setItemDelegateForColumn(MESSAGE_COL_RSSI, new DecimalDelegate(1)); + ui->messages->setItemDelegateForColumn(MESSAGE_COL_ERROR_PERCENT, new DecimalDelegate(1, ui->messages)); + ui->messages->setItemDelegateForColumn(MESSAGE_COL_RSSI, new DecimalDelegate(1, ui->messages)); m_scopeVis = m_navtexDemod->getScopeSink(); m_scopeVis->setGLScope(ui->glScope); From 055c03c2b72d472be4eb84c578de0b770b78d68d Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Sat, 8 Jun 2024 23:01:03 +0200 Subject: [PATCH 5/9] Fix memleaks Frees memory allocated in in NoiseFigureGUI::NoiseFigureGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) ...sdrangel/plugins/channelrx/noisefigure/noisefiguregui.cpp:600 in NoiseFigureGUI::NoiseFigureGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) ...sdrangel/plugins/channelrx/noisefigure/noisefiguregui.cpp:660 in NoiseFigureGUI::NoiseFigureGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) ...sdrangel/plugins/channelrx/noisefigure/noisefiguregui.cpp:661 in NoiseFigureGUI::NoiseFigureGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) ...sdrangel/plugins/channelrx/noisefigure/noisefiguregui.cpp:662 in NoiseFigureGUI::NoiseFigureGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) ...sdrangel/plugins/channelrx/noisefigure/noisefiguregui.cpp:663 in NoiseFigureGUI::NoiseFigureGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) ...sdrangel/plugins/channelrx/noisefigure/noisefiguregui.cpp:664 --- plugins/channelrx/noisefigure/noisefiguregui.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/channelrx/noisefigure/noisefiguregui.cpp b/plugins/channelrx/noisefigure/noisefiguregui.cpp index 9c0ba3f1d..b371b3061 100644 --- a/plugins/channelrx/noisefigure/noisefiguregui.cpp +++ b/plugins/channelrx/noisefigure/noisefiguregui.cpp @@ -657,11 +657,11 @@ NoiseFigureGUI::NoiseFigureGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, B ui->results->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->results, SIGNAL(customContextMenuRequested(QPoint)), SLOT(customContextMenuRequested(QPoint))); - ui->results->setItemDelegateForColumn(RESULTS_COL_NF, new DecimalDelegate(2)); - ui->results->setItemDelegateForColumn(RESULTS_COL_TEMP, new DecimalDelegate(0)); - ui->results->setItemDelegateForColumn(RESULTS_COL_Y, new DecimalDelegate(2)); - ui->results->setItemDelegateForColumn(RESULTS_COL_ENR, new DecimalDelegate(2)); - ui->results->setItemDelegateForColumn(RESULTS_COL_FLOOR, new DecimalDelegate(1)); + ui->results->setItemDelegateForColumn(RESULTS_COL_NF, new DecimalDelegate(2, ui->results)); + ui->results->setItemDelegateForColumn(RESULTS_COL_TEMP, new DecimalDelegate(0, ui->results)); + ui->results->setItemDelegateForColumn(RESULTS_COL_Y, new DecimalDelegate(2, ui->results)); + ui->results->setItemDelegateForColumn(RESULTS_COL_ENR, new DecimalDelegate(2, ui->results)); + ui->results->setItemDelegateForColumn(RESULTS_COL_FLOOR, new DecimalDelegate(1, ui->results)); ui->startStop->setStyleSheet(QString("QToolButton{ background-color: blue; } QToolButton:checked{ background-color: green; }")); From 3849b1806f71ac9f93394adaed0eb22308d3f927 Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Sat, 8 Jun 2024 23:16:27 +0200 Subject: [PATCH 6/9] Fix memleaks Frees memory allocated in FreqScannerGUI::FreqScannerGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/freqscanner/freqscannergui.cpp:499 in FreqScannerGUI::FreqScannerGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/freqscanner/freqscannergui.cpp:500 in FreqScannerGUI::FreqScannerGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/freqscanner/freqscannergui.cpp:501 in FreqScannerGUI::FreqScannerGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/freqscanner/freqscannergui.cpp:502 in FreqScannerGUI::FreqScannerGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/freqscanner/freqscannergui.cpp:503 --- plugins/channelrx/freqscanner/freqscannergui.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/channelrx/freqscanner/freqscannergui.cpp b/plugins/channelrx/freqscanner/freqscannergui.cpp index 2e725c598..9660542c2 100644 --- a/plugins/channelrx/freqscanner/freqscannergui.cpp +++ b/plugins/channelrx/freqscanner/freqscannergui.cpp @@ -496,11 +496,11 @@ FreqScannerGUI::FreqScannerGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, B applyAllSettings(); m_resizer.enableChildMouseTracking(); - ui->table->setItemDelegateForColumn(COL_FREQUENCY, new FrequencyDelegate("Auto", 3)); - ui->table->setItemDelegateForColumn(COL_POWER, new DecimalDelegate(1)); - ui->table->setItemDelegateForColumn(COL_CHANNEL_BW, new Int64Delegate(0, 10000000)); - ui->table->setItemDelegateForColumn(COL_TH, new DecimalDelegate(1, -120.0, 0.0)); - ui->table->setItemDelegateForColumn(COL_SQ, new DecimalDelegate(1, -120.0, 0.0)); + ui->table->setItemDelegateForColumn(COL_FREQUENCY, new FrequencyDelegate("Auto", 3, true, ui->table)); + ui->table->setItemDelegateForColumn(COL_POWER, new DecimalDelegate(1, ui->table)); + ui->table->setItemDelegateForColumn(COL_CHANNEL_BW, new Int64Delegate(0, 10000000, ui->table)); + ui->table->setItemDelegateForColumn(COL_TH, new DecimalDelegate(1, -120.0, 0.0, ui->table)); + ui->table->setItemDelegateForColumn(COL_SQ, new DecimalDelegate(1, -120.0, 0.0, ui->table)); connect(m_deviceUISet->m_spectrum->getSpectrumView(), &GLSpectrumView::updateAnnotations, this, &FreqScannerGUI::updateAnnotations); } From 2fff671a33191e2db70593feb3ac3450218102ee Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Sun, 9 Jun 2024 19:14:51 +0200 Subject: [PATCH 7/9] Add a parent pointer to TimeDeltaDelegate, HMSDelegate and DMSDelegate --- plugins/channelrx/radioastronomy/radioastronomygui.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/channelrx/radioastronomy/radioastronomygui.cpp b/plugins/channelrx/radioastronomy/radioastronomygui.cpp index 370da38cc..36e3bf574 100644 --- a/plugins/channelrx/radioastronomy/radioastronomygui.cpp +++ b/plugins/channelrx/radioastronomy/radioastronomygui.cpp @@ -66,6 +66,9 @@ class TimeDeltaDelegate : public QStyledItemDelegate { public: + TimeDeltaDelegate(QObject *parent = nullptr) : + QStyledItemDelegate(parent) {} + virtual QString displayText(const QVariant &value, const QLocale &locale) const override { (void) locale; @@ -97,6 +100,9 @@ private: class HMSDelegate : public QStyledItemDelegate { public: + HMSDelegate(QObject *parent = nullptr) : + QStyledItemDelegate(parent) {} + virtual QString displayText(const QVariant &value, const QLocale &locale) const override { (void) locale; @@ -109,6 +115,9 @@ public: class DMSDelegate : public QStyledItemDelegate { public: + DMSDelegate(QObject *parent = nullptr) : + QStyledItemDelegate(parent) {} + virtual QString displayText(const QVariant &value, const QLocale &locale) const override { (void) locale; From 31ad607721f109363e1f0567dff66a715f53316d Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Sat, 8 Jun 2024 23:46:22 +0200 Subject: [PATCH 8/9] Fix memleaks Frees memory allocated in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2126 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2128 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2129 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2130 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2131 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2132 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2133 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2134 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2135 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2136 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2137 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2138 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2139 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2140 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2141 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2142 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2143 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2144 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2145 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2146 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2147 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2148 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2149 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2150 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2153 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2154 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2155 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2156 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2157 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2158 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2159 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2160 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2161 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2190 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2191 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2192 in RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI*, DeviceUISet*, BasebandSampleSink*, QWidget*) .../plugins/channelrx/radioastronomy/radioastronomygui.cpp:2193 and a comment :) --- .../radioastronomy/radioastronomygui.cpp | 76 +++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/plugins/channelrx/radioastronomy/radioastronomygui.cpp b/plugins/channelrx/radioastronomy/radioastronomygui.cpp index 36e3bf574..d26eddbd4 100644 --- a/plugins/channelrx/radioastronomy/radioastronomygui.cpp +++ b/plugins/channelrx/radioastronomy/radioastronomygui.cpp @@ -2132,42 +2132,42 @@ RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUI ui->powerTable->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->powerTable, SIGNAL(customContextMenuRequested(QPoint)), SLOT(customContextMenuRequested(QPoint))); - ui->powerTable->setItemDelegateForColumn(POWER_COL_TIME, new TimeDelegate()); - //ui->powerTable->setItemDelegateForColumn(POWER_COL_POWER, new DecimalDelegate(6)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_POWER_DB, new DecimalDelegate(1)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_POWER_DBM, new DecimalDelegate(1)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_TSYS, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_TSYS0, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_TSOURCE, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_TB, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_TSKY, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_FLUX, new DecimalDelegate(2)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_SIGMA_T, new DecimalDelegate(2)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_SIGMA_S, new DecimalDelegate(1)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_RA, new HMSDelegate()); - ui->powerTable->setItemDelegateForColumn(POWER_COL_DEC, new DMSDelegate()); - ui->powerTable->setItemDelegateForColumn(POWER_COL_GAL_LAT, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_GAL_LON, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_AZ, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_EL, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_VBCRS, new DecimalDelegate(1)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_VLSR, new DecimalDelegate(1)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_AIR_TEMP, new DecimalDelegate(1)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_ROT_AZ, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_ROT_EL, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_ROT_AZ_OFF, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_ROT_EL_OFF, new DecimalDelegate(0)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_TIME, new TimeDelegate("hh:mm:ss", ui->powerTable)); + //ui->powerTable->setItemDelegateForColumn(POWER_COL_POWER, new DecimalDelegate(6, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_POWER_DB, new DecimalDelegate(1, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_POWER_DBM, new DecimalDelegate(1, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_TSYS, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_TSYS0, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_TSOURCE, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_TB, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_TSKY, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_FLUX, new DecimalDelegate(2, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_SIGMA_T, new DecimalDelegate(2, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_SIGMA_S, new DecimalDelegate(1, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_RA, new HMSDelegate(ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_DEC, new DMSDelegate(ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_GAL_LAT, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_GAL_LON, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_AZ, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_EL, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_VBCRS, new DecimalDelegate(1, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_VLSR, new DecimalDelegate(1, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_AIR_TEMP, new DecimalDelegate(1, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_ROT_AZ, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_ROT_EL, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_ROT_AZ_OFF, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_ROT_EL_OFF, new DecimalDelegate(0, ui->powerTable)); resizeSpectrumMarkerTable(); - ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_FREQ, new DecimalDelegate(6)); - ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_VALUE, new DecimalDelegate(1)); - ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_DELTA_X, new DecimalDelegate(6)); - ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_DELTA_Y, new DecimalDelegate(1)); - ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_VR, new DecimalDelegate(2)); - ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_R, new DecimalDelegate(1)); - ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_D, new DecimalDelegate(1)); - ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_R_MIN, new DecimalDelegate(1)); - ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_V, new DecimalDelegate(1)); + ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_FREQ, new DecimalDelegate(6, ui->spectrumMarkerTable)); + ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_VALUE, new DecimalDelegate(1, ui->spectrumMarkerTable)); + ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_DELTA_X, new DecimalDelegate(6, ui->spectrumMarkerTable)); + ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_DELTA_Y, new DecimalDelegate(1, ui->spectrumMarkerTable)); + ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_VR, new DecimalDelegate(2, ui->spectrumMarkerTable)); + ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_R, new DecimalDelegate(1, ui->spectrumMarkerTable)); + ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_D, new DecimalDelegate(1, ui->spectrumMarkerTable)); + ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_R_MIN, new DecimalDelegate(1, ui->spectrumMarkerTable)); + ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_V, new DecimalDelegate(1, ui->spectrumMarkerTable)); // Create blank marker table ui->spectrumMarkerTable->setRowCount(SPECTRUM_MARKER_ROWS); // 1 peak and two markers @@ -2196,10 +2196,10 @@ RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUI connect(ui->spectrumMarkerTable, &QTableWidget::itemChanged, this, &RadioAstronomyGUI::spectrumMarkerTableItemChanged); resizePowerMarkerTable(); - ui->powerMarkerTable->setItemDelegateForColumn(POWER_MARKER_COL_TIME, new TimeDelegate()); - ui->powerMarkerTable->setItemDelegateForColumn(POWER_MARKER_COL_VALUE, new DecimalDelegate(1)); - ui->powerMarkerTable->setItemDelegateForColumn(POWER_MARKER_COL_DELTA_X, new TimeDeltaDelegate()); - ui->powerMarkerTable->setItemDelegateForColumn(POWER_MARKER_COL_DELTA_Y, new DecimalDelegate(1)); + ui->powerMarkerTable->setItemDelegateForColumn(POWER_MARKER_COL_TIME, new TimeDelegate("hh:mm:ss", ui->powerMarkerTable)); + ui->powerMarkerTable->setItemDelegateForColumn(POWER_MARKER_COL_VALUE, new DecimalDelegate(1, ui->powerMarkerTable)); + ui->powerMarkerTable->setItemDelegateForColumn(POWER_MARKER_COL_DELTA_X, new TimeDeltaDelegate(ui->powerMarkerTable)); + ui->powerMarkerTable->setItemDelegateForColumn(POWER_MARKER_COL_DELTA_Y, new DecimalDelegate(1, ui->powerMarkerTable)); // Create blank marker table ui->powerMarkerTable->setRowCount(POWER_MARKER_ROWS); // 1 peak and two markers From b1a460fca8dd9f2d2544c140b5c0e90f09113df0 Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Sun, 9 Jun 2024 13:26:17 +0200 Subject: [PATCH 9/9] Fix memleaks Frees memory allocated in SpectrumMeasurements::createPeakTable(int) .../sdrgui/gui/spectrummeasurements.cpp:303 in SpectrumMeasurements::createPeakTable(int) .../sdrgui/gui/spectrummeasurements.cpp:304 --- sdrgui/gui/spectrummeasurements.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdrgui/gui/spectrummeasurements.cpp b/sdrgui/gui/spectrummeasurements.cpp index 2ff356718..3ee45f2d6 100644 --- a/sdrgui/gui/spectrummeasurements.cpp +++ b/sdrgui/gui/spectrummeasurements.cpp @@ -300,8 +300,8 @@ void SpectrumMeasurements::createPeakTable(int peaks) m_peakTable->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); m_peakTable->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents); - m_peakTable->setItemDelegateForColumn(COL_FREQUENCY, new UnitsDelegate()); - m_peakTable->setItemDelegateForColumn(COL_POWER, new UnitsDelegate()); + m_peakTable->setItemDelegateForColumn(COL_FREQUENCY, new UnitsDelegate(m_peakTable)); + m_peakTable->setItemDelegateForColumn(COL_POWER, new UnitsDelegate(m_peakTable)); // Cell context menu m_peakTable->setContextMenuPolicy(Qt::CustomContextMenu);