Browse Source

Partly rework Deleting Devices, seems to fix random(and sometimes not so random) crashes

master
aj_genius 21 years ago
parent
commit
6e4baf30a9
2 changed files with 16 additions and 13 deletions
  1. +2
    -5
      SpiralSound/Plugins/SpiralPlugin.C
  2. +14
    -8
      SpiralSynthModular.C

+ 2
- 5
SpiralSound/Plugins/SpiralPlugin.C View File

@@ -39,11 +39,8 @@ SpiralPlugin::SpiralPlugin()

SpiralPlugin::~SpiralPlugin()
{
for (int n=0; n<m_PluginInfo.NumOutputs; n++)
{
delete m_Output[n];
}
RemoveAllOutputs();
RemoveAllInputs();
delete m_AudioCH;
}



+ 14
- 8
SpiralSynthModular.C View File

@@ -202,24 +202,30 @@ void SynthModular::UpdatePluginGUIs()
if (i->second->m_DeviceGUI->Killed())
{
PauseAudio();
if (i->second->m_Device)
{
delete i->second->m_Device;
i->second->m_Device=NULL;
}

//Hide Device GUI FIRST
if (i->second->m_DeviceGUI->GetPluginWindow())
{
i->second->m_DeviceGUI->GetPluginWindow()->hide();
//m_MainWindow->remove(i->second->m_DeviceGUI->GetPluginWindow());
}

//Clear and remove Device GUI from canvas
i->second->m_DeviceGUI->Clear();
m_Canvas->RemoveDevice(i->second->m_DeviceGUI);
// deleted by Canvas::Remove()? seems to cause random crashes
//delete i->second->m_DeviceGUI;
//Delete Device GUI - must delete here or sometimes plugin will randomly crash
delete i->second->m_DeviceGUI;

//Delete Device Sometimes deleting audio before GUI causes an odd crash, so do it afterword
if (i->second->m_Device)
{
delete i->second->m_Device;
i->second->m_Device=NULL;
}

//Erase Device from DeviceWinMap
m_DeviceWinMap.erase(i);
ResumeAudio();
break;
}


Loading…
Cancel
Save