From 9ac66a33968a733785edea6b51fda0a54ad9c7dc Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Sun, 19 May 2024 22:30:22 +0200 Subject: [PATCH 1/2] Fix memleaks Fixes leaks: in SIDGUI::SIDGUI(PluginAPI*, FeatureUISet*, Feature*, QWidget*) plugins/feature/sid/sidgui.cpp:257 in SIDGUI::SIDGUI(PluginAPI*, FeatureUISet*, Feature*, QWidget*) plugins/feature/sid/sidgui.cpp:249 in SIDGUI::SIDGUI(PluginAPI*, FeatureUISet*, Feature*, QWidget*) plugins/feature/sid/sidgui.cpp:215 --- plugins/feature/sid/sidgui.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/feature/sid/sidgui.cpp b/plugins/feature/sid/sidgui.cpp index f5639cd3ad..2bbdc897b9 100644 --- a/plugins/feature/sid/sidgui.cpp +++ b/plugins/feature/sid/sidgui.cpp @@ -300,15 +300,18 @@ SIDGUI::~SIDGUI() disconnectDataUpdates(); if (m_grb) { disconnect(m_grb, &GRB::dataUpdated, this, &SIDGUI::grbDataUpdated); + delete m_grb; } if (m_stix) { disconnect(m_stix, &STIX::dataUpdated, this, &SIDGUI::stixDataUpdated); + delete m_stix; } m_statusTimer.stop(); clearFromMap(); delete m_goesXRay; + delete m_solarDynamicsObservatory; delete ui; } From 3106b2c9dae6dcab4417ae62600876afdf0ce6c1 Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Sun, 19 May 2024 22:51:26 +0200 Subject: [PATCH 2/2] Remove unneeded calls to disconnect signals Signals are automatically disconnected when QObjects are destroyed: https://doc.qt.io/qt-5/qobject.html#dtor.QObject --- plugins/feature/sid/sidgui.cpp | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/plugins/feature/sid/sidgui.cpp b/plugins/feature/sid/sidgui.cpp index 2bbdc897b9..7627e7a352 100644 --- a/plugins/feature/sid/sidgui.cpp +++ b/plugins/feature/sid/sidgui.cpp @@ -284,28 +284,9 @@ SIDGUI::SIDGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *featur SIDGUI::~SIDGUI() { - QObject::disconnect(ui->chartSplitter, &QSplitter::splitterMoved, this, &SIDGUI::chartSplitterMoved); - QObject::disconnect(ui->sdoSplitter, &QSplitter::splitterMoved, this, &SIDGUI::sdoSplitterMoved); + delete m_grb; + delete m_stix; - QObject::disconnect(&m_availableFeatureHandler, - &AvailableChannelOrFeatureHandler::channelsOrFeaturesChanged, - this, - &SIDGUI::featuresChanged - ); - QObject::disconnect(&m_availableChannelHandler, - &AvailableChannelOrFeatureHandler::channelsOrFeaturesChanged, - this, - &SIDGUI::channelsChanged - ); - disconnectDataUpdates(); - if (m_grb) { - disconnect(m_grb, &GRB::dataUpdated, this, &SIDGUI::grbDataUpdated); - delete m_grb; - } - if (m_stix) { - disconnect(m_stix, &STIX::dataUpdated, this, &SIDGUI::stixDataUpdated); - delete m_stix; - } m_statusTimer.stop(); clearFromMap();