From a014491e61362fa26162c3aca4962b52ef266e00 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 25 Aug 2024 00:41:39 +0200 Subject: [PATCH] Removed the destroy method from ChannelGUI interface --- sdrgui/channel/channelgui.h | 5 ++--- sdrgui/device/deviceuiset.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/sdrgui/channel/channelgui.h b/sdrgui/channel/channelgui.h index bd733c7ee..037133262 100644 --- a/sdrgui/channel/channelgui.h +++ b/sdrgui/channel/channelgui.h @@ -56,9 +56,8 @@ public: ContextMenuChannelSettings }; - ChannelGUI(QWidget *parent = nullptr); - virtual ~ChannelGUI(); - virtual void destroy() = 0; + explicit ChannelGUI(QWidget *parent = nullptr); + ~ChannelGUI() override; virtual void resetToDefaults() = 0; // Data saved in the derived settings diff --git a/sdrgui/device/deviceuiset.cpp b/sdrgui/device/deviceuiset.cpp index 3c83f1dac..b5a12705a 100644 --- a/sdrgui/device/deviceuiset.cpp +++ b/sdrgui/device/deviceuiset.cpp @@ -166,7 +166,7 @@ void DeviceUISet::freeChannels() for(int i = 0; i < m_channelInstanceRegistrations.count(); i++) { qDebug("DeviceUISet::freeChannels: destroying channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelAPI->getURI())); - m_channelInstanceRegistrations[i].m_gui->destroy(); + delete m_channelInstanceRegistrations[i].m_gui; delete m_channelInstanceRegistrations[i].m_channelAPI; } @@ -181,7 +181,7 @@ void DeviceUISet::deleteChannel(int channelIndex) qDebug("DeviceUISet::deleteChannel: delete channel [%s] at %d", qPrintable(m_channelInstanceRegistrations[channelIndex].m_channelAPI->getURI()), channelIndex); - m_channelInstanceRegistrations[channelIndex].m_gui->destroy(); + delete m_channelInstanceRegistrations[channelIndex].m_gui; delete m_channelInstanceRegistrations[channelIndex].m_channelAPI; m_channelInstanceRegistrations.removeAt(channelIndex); } @@ -320,7 +320,7 @@ void DeviceUISet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginA qDebug("DeviceUISet::loadRxChannelSettings: destroying old channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelAPI->getURI())); m_channelInstanceRegistrations[i].m_channelAPI->setMessageQueueToGUI(nullptr); // have channel stop sending messages to its GUI - m_channelInstanceRegistrations[i].m_gui->destroy(); + delete m_channelInstanceRegistrations[i].m_gui; delete m_channelInstanceRegistrations[i].m_channelAPI; } @@ -449,7 +449,7 @@ void DeviceUISet::loadTxChannelSettings(const Preset *preset, PluginAPI *pluginA qDebug("DeviceUISet::loadTxChannelSettings: destroying old channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelAPI->getURI())); m_channelInstanceRegistrations[i].m_channelAPI->setMessageQueueToGUI(nullptr); // have channel stop sending messages to its GUI - m_channelInstanceRegistrations[i].m_gui->destroy(); + delete m_channelInstanceRegistrations[i].m_gui; delete m_channelInstanceRegistrations[i].m_channelAPI; } @@ -575,7 +575,7 @@ void DeviceUISet::loadMIMOChannelSettings(const Preset *preset, PluginAPI *plugi { qDebug("DeviceUISet::loadMIMOChannelSettings: destroying old channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelAPI->getURI())); - m_channelInstanceRegistrations[i].m_gui->destroy(); // stop GUI first (issue #1427) + delete m_channelInstanceRegistrations[i].m_gui; // stop GUI first (issue #1427) delete m_channelInstanceRegistrations[i].m_channelAPI; // stop channel before (issue #860) }