1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

Corrected order of deletion of channel vs channel GUI. Fixes #1332

This commit is contained in:
f4exb 2022-07-21 05:26:58 +02:00
parent ef873c00bb
commit bd7fd29de9
2 changed files with 16 additions and 4 deletions

View File

@ -161,8 +161,8 @@ 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_channelAPI->destroy();
m_channelInstanceRegistrations[i].m_gui->destroy();
m_channelInstanceRegistrations[i].m_channelAPI->destroy();
}
m_channelInstanceRegistrations.clear();
@ -176,8 +176,8 @@ 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_channelAPI->destroy();
m_channelInstanceRegistrations[channelIndex].m_gui->destroy();
m_channelInstanceRegistrations[channelIndex].m_channelAPI->destroy();
m_channelInstanceRegistrations.removeAt(channelIndex);
}
@ -723,8 +723,14 @@ void DeviceUISet::handleChannelGUIClosing(ChannelGUI* channelGUI)
{
if (it->m_gui == channelGUI)
{
m_deviceSet->removeChannelInstance(it->m_channelAPI);
it->m_channelAPI->destroy();
ChannelAPI *channelAPI = it->m_channelAPI;
m_deviceSet->removeChannelInstance(channelAPI);
QObject::connect(
channelGUI,
&ChannelGUI::destroyed,
this,
[this, channelAPI](){ this->handleDeleteChannel(channelAPI); }
);
m_channelInstanceRegistrations.erase(it);
break;
}
@ -736,6 +742,11 @@ void DeviceUISet::handleChannelGUIClosing(ChannelGUI* channelGUI)
}
}
void DeviceUISet::handleDeleteChannel(ChannelAPI *channelAPI)
{
channelAPI->destroy();
}
int DeviceUISet::webapiSpectrumSettingsGet(SWGSDRangel::SWGGLSpectrum& response, QString& errorMessage) const
{
return m_spectrumVis->webapiSpectrumSettingsGet(response, errorMessage);

View File

@ -158,6 +158,7 @@ private:
private slots:
void handleChannelGUIClosing(ChannelGUI* channelGUI);
void handleDeleteChannel(ChannelAPI *channelAPI);
};