1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

Main Core: moved source/sink API destruction last

This commit is contained in:
f4exb 2018-02-15 00:27:29 +01:00
parent 8c05974686
commit db6cfe2257

View File

@ -342,12 +342,14 @@ void MainCore::removeLastDevice()
m_deviceSets.back()->m_deviceSourceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceInput( m_deviceSets.back()->m_deviceSourceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceInput(
m_deviceSets.back()->m_deviceSourceAPI->getSampleSource()); m_deviceSets.back()->m_deviceSourceAPI->getSampleSource());
m_deviceSets.back()->m_deviceSourceAPI->clearBuddiesLists(); // clear old API buddies lists m_deviceSets.back()->m_deviceSourceAPI->clearBuddiesLists(); // clear old API buddies lists
delete m_deviceSets.back()->m_deviceSourceAPI;
DeviceSourceAPI *sourceAPI = m_deviceSets.back()->m_deviceSourceAPI;
delete m_deviceSets.back(); delete m_deviceSets.back();
lastDeviceEngine->stop(); lastDeviceEngine->stop();
m_dspEngine->removeLastDeviceSourceEngine(); m_dspEngine->removeLastDeviceSourceEngine();
delete sourceAPI;
} }
else if (m_deviceSets.back()->m_deviceSinkEngine) // sink set else if (m_deviceSets.back()->m_deviceSinkEngine) // sink set
{ {
@ -360,12 +362,14 @@ void MainCore::removeLastDevice()
m_deviceSets.back()->m_deviceSinkAPI->getPluginInterface()->deleteSampleSinkPluginInstanceOutput( m_deviceSets.back()->m_deviceSinkAPI->getPluginInterface()->deleteSampleSinkPluginInstanceOutput(
m_deviceSets.back()->m_deviceSinkAPI->getSampleSink()); m_deviceSets.back()->m_deviceSinkAPI->getSampleSink());
m_deviceSets.back()->m_deviceSinkAPI->clearBuddiesLists(); // clear old API buddies lists m_deviceSets.back()->m_deviceSinkAPI->clearBuddiesLists(); // clear old API buddies lists
delete m_deviceSets.back()->m_deviceSinkAPI;
DeviceSinkAPI *sinkAPI = m_deviceSets.back()->m_deviceSinkAPI;
delete m_deviceSets.back(); delete m_deviceSets.back();
lastDeviceEngine->stop(); lastDeviceEngine->stop();
m_dspEngine->removeLastDeviceSinkEngine(); m_dspEngine->removeLastDeviceSinkEngine();
delete sinkAPI;
} }
m_deviceSets.pop_back(); m_deviceSets.pop_back();