Browse Source

fix: segfault If no trailing "/" on PluginPath command line option.

master
edgeeffect 22 years ago
parent
commit
6401f3a406
1 changed files with 16 additions and 11 deletions
  1. +16
    -11
      SpiralSynthModular.C

+ 16
- 11
SpiralSynthModular.C View File

@@ -454,7 +454,7 @@ void SynthModular::LoadPlugins(string pluginPath)


int Width = 40; int Width = 40;
int Height = 40; int Height = 40;
int SWidth = 256; int SWidth = 256;
int SHeight = 256; int SHeight = 256;
@@ -479,15 +479,20 @@ void SynthModular::LoadPlugins(string pluginPath)
int ID=-1; int ID=-1;


vector<string> PluginVector; vector<string> PluginVector;
if (SpiralSynthModularInfo::USEPLUGINLIST) if (SpiralSynthModularInfo::USEPLUGINLIST)
{ {
PluginVector=SpiralSynthModularInfo::PLUGINVEC; PluginVector=SpiralSynthModularInfo::PLUGINVEC;
} }
else else
{ {
if (!pluginPath.empty()) PluginVector=BuildPluginList(pluginPath);
else PluginVector=BuildPluginList(SpiralSynthModularInfo::PLUGIN_PATH);
if (pluginPath.empty())
PluginVector=BuildPluginList(SpiralSynthModularInfo::PLUGIN_PATH);
else {
string::iterator i = pluginPath.end() - 1;
if (*i != '/') pluginPath += '/';
PluginVector=BuildPluginList(pluginPath);
}
} }


for (vector<string>::iterator i=PluginVector.begin(); for (vector<string>::iterator i=PluginVector.begin();
@@ -505,21 +510,21 @@ void SynthModular::LoadPlugins(string pluginPath)


ID=PluginManager::Get()->LoadPlugin(Fullpath.c_str()); ID=PluginManager::Get()->LoadPlugin(Fullpath.c_str());
if (ID!=PluginError) if (ID!=PluginError)
{
{
#ifdef DEBUG_PLUGINS #ifdef DEBUG_PLUGINS
cerr<<"Plugin ["<<*i<<"] = "<<ID<<endl; cerr<<"Plugin ["<<*i<<"] = "<<ID<<endl;
#endif #endif
Fl_Button *NewButton = new Fl_Button(0,0,Width,Height,""); Fl_Button *NewButton = new Fl_Button(0,0,Width,Height,"");
NewButton->labelsize(10); NewButton->labelsize(10);
Fl_Pixmap *tPix = new Fl_Pixmap(PluginManager::Get()->GetPlugin(ID)->GetIcon()); Fl_Pixmap *tPix = new Fl_Pixmap(PluginManager::Get()->GetPlugin(ID)->GetIcon());
NewButton->image(tPix->copy(tPix->w(),tPix->h()));
delete tPix;
NewButton->image(tPix->copy(tPix->w(),tPix->h()));
delete tPix;
string GroupName = PluginManager::Get()->GetPlugin(ID)->GetGroupName(); string GroupName = PluginManager::Get()->GetPlugin(ID)->GetGroupName();
ToolBox* Tool=NULL; ToolBox* Tool=NULL;
map<string,ToolBox*>::iterator ti=m_PluginGroupMap.find(GroupName); map<string,ToolBox*>::iterator ti=m_PluginGroupMap.find(GroupName);
if (ti==m_PluginGroupMap.end()) if (ti==m_PluginGroupMap.end())
{ {


Loading…
Cancel
Save