Bug 1587 - Mac: Ghost duplicate Nyquist effects after upgrade

Fix removes ghost Nyquist effects from the effects menu and generators from generate menu.
This commit is contained in:
James Crook 2017-02-05 20:27:56 +00:00
parent 31df61f537
commit e4260e9581
17 changed files with 45 additions and 21 deletions

View File

@ -91,7 +91,7 @@ public:
// For modules providing an interface to other dynamically loaded plugins,
// the module returns true if the plugin is still valid, otherwise false.
virtual bool IsPluginValid(const wxString & path) = 0;
virtual bool IsPluginValid(const wxString & path, bool bFast) = 0;
// When appropriate, CreateInstance() will be called to instantiate the plugin.
virtual IdentInterface *CreateInstance(const wxString & path) = 0;

View File

@ -601,13 +601,14 @@ bool ModuleManager::IsProviderValid(const PluginID & WXUNUSED(providerID),
}
bool ModuleManager::IsPluginValid(const PluginID & providerID,
const wxString & path)
const wxString & path,
bool bFast)
{
if (mDynModules.find(providerID) == mDynModules.end())
{
return false;
}
return mDynModules[providerID]->IsPluginValid(path);
return mDynModules[providerID]->IsPluginValid(path, bFast);
}

View File

@ -104,7 +104,7 @@ public:
void DeleteInstance(const PluginID & provider, IdentInterface *instance);
bool IsProviderValid(const PluginID & provider, const wxString & path);
bool IsPluginValid(const PluginID & provider, const wxString & path);
bool IsPluginValid(const PluginID & provider, const wxString & path, bool bFast);
private:
// I'm a singleton class

View File

@ -1697,6 +1697,9 @@ void PluginManager::Initialize()
// And finally check for updates
#ifndef EXPERIMENTAL_EFFECT_MANAGEMENT
CheckForUpdates();
#else
const bool kFast = true;
CheckForUpdates( kFast );
#endif
}
@ -2105,7 +2108,10 @@ void PluginManager::SaveGroup(wxFileConfig *pRegistry, PluginType type)
return;
}
void PluginManager::CheckForUpdates()
// If bFast is true, do not do a full check. Just check the ones
// that are quick to check. Currently (Feb 2017) just Nyquist
// and built-ins.
void PluginManager::CheckForUpdates(bool bFast)
{
// Get ModuleManager reference
ModuleManager & mm = ModuleManager::Get();
@ -2148,9 +2154,13 @@ void PluginManager::CheckForUpdates()
continue;
}
if (plugType == PluginTypeModule)
if ( (plugType == PluginTypeModule) )
{
if (!mm.IsProviderValid(plugID, plugPath))
if( bFast )
{
// Skip modules, when doing a fast refresh/check.
}
else if (!mm.IsProviderValid(plugID, plugPath))
{
plug.SetEnabled(false);
plug.SetValid(false);
@ -2178,7 +2188,7 @@ void PluginManager::CheckForUpdates()
}
else if (plugType != PluginTypeNone && plugType != PluginTypeStub)
{
plug.SetValid(mm.IsPluginValid(plug.GetProviderID(), plugPath));
plug.SetValid(mm.IsPluginValid(plug.GetProviderID(), plugPath, bFast));
if (!plug.IsValid())
{
plug.SetEnabled(false);

View File

@ -254,7 +254,7 @@ public:
wxString GetName(const PluginID & ID);
IdentInterface *GetInstance(const PluginID & ID);
void CheckForUpdates();
void CheckForUpdates(bool bFast = false);
bool ShowManager(wxWindow *parent, EffectType type = EffectTypeNone);

View File

@ -321,8 +321,10 @@ bool BuiltinEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxS
return false;
}
bool BuiltinEffectsModule::IsPluginValid(const wxString & path)
bool BuiltinEffectsModule::IsPluginValid(const wxString & path, bool bFast)
{
// bFast is unused as checking in the list is fast.
bFast;
return mNames.Index(path) != wxNOT_FOUND;
}

View File

@ -45,7 +45,7 @@ public:
wxArrayString FindPlugins(PluginManagerInterface & pm) override;
bool RegisterPlugin(PluginManagerInterface & pm, const wxString & path) override;
bool IsPluginValid(const wxString & path) override;
bool IsPluginValid(const wxString & path, bool bFast) override;
IdentInterface *CreateInstance(const wxString & path) override;
void DeleteInstance(IdentInterface *instance) override;

View File

@ -616,8 +616,10 @@ bool VSTEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxStrin
return valid;
}
bool VSTEffectsModule::IsPluginValid(const wxString & path)
bool VSTEffectsModule::IsPluginValid(const wxString & path, bool bFast)
{
if( bFast )
return true;
wxString realPath = path.BeforeFirst(wxT(';'));
return wxFileName::FileExists(realPath) || wxFileName::DirExists(realPath);
}

View File

@ -389,7 +389,7 @@ public:
wxArrayString FindPlugins(PluginManagerInterface & pm) override;
bool RegisterPlugin(PluginManagerInterface & pm, const wxString & path) override;
bool IsPluginValid(const wxString & path) override;
bool IsPluginValid(const wxString & path, bool bFast) override;
IdentInterface *CreateInstance(const wxString & path) override;
void DeleteInstance(IdentInterface *instance) override;

View File

@ -255,8 +255,10 @@ bool LadspaEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxSt
return index > 0;
}
bool LadspaEffectsModule::IsPluginValid(const wxString & path)
bool LadspaEffectsModule::IsPluginValid(const wxString & path, bool bFast)
{
if( bFast )
return true;
wxString realPath = path.BeforeFirst(wxT(';'));
return wxFileName::FileExists(realPath);
}

View File

@ -226,7 +226,7 @@ public:
wxArrayString FindPlugins(PluginManagerInterface & pm) override;
bool RegisterPlugin(PluginManagerInterface & pm, const wxString & path) override;
bool IsPluginValid(const wxString & path) override;
bool IsPluginValid(const wxString & path, bool bFast) override;
IdentInterface *CreateInstance(const wxString & path) override;
void DeleteInstance(IdentInterface *instance) override;

View File

@ -260,8 +260,10 @@ bool LV2EffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxStrin
return true;
}
bool LV2EffectsModule::IsPluginValid(const wxString & path)
bool LV2EffectsModule::IsPluginValid(const wxString & path, bool bFast)
{
if( bFast )
return true;
return GetPlugin(path) != NULL;
}

View File

@ -92,7 +92,7 @@ public:
wxArrayString FindPlugins(PluginManagerInterface & pm) override;
bool RegisterPlugin(PluginManagerInterface & pm, const wxString & path) override;
bool IsPluginValid(const wxString & path) override;
bool IsPluginValid(const wxString & path, bool bFast) override;
IdentInterface *CreateInstance(const wxString & path) override;
void DeleteInstance(IdentInterface *instance) override;

View File

@ -216,8 +216,11 @@ bool NyquistEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxS
return false;
}
bool NyquistEffectsModule::IsPluginValid(const wxString & path)
bool NyquistEffectsModule::IsPluginValid(const wxString & path, bool bFast)
{
// Ignores bFast parameter, since checking file exists is fast enough for
// the small number of Nyquist plug-ins that we have.
bFast;
if (path == NYQUIST_PROMPT_ID)
{
return true;

View File

@ -42,7 +42,7 @@ public:
wxArrayString FindPlugins(PluginManagerInterface & pm) override;
bool RegisterPlugin(PluginManagerInterface & pm, const wxString & path) override;
bool IsPluginValid(const wxString & path) override;
bool IsPluginValid(const wxString & path, bool bFast) override;
IdentInterface *CreateInstance(const wxString & path) override;
void DeleteInstance(IdentInterface *instance) override;

View File

@ -216,10 +216,12 @@ bool VampEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxStri
return false;
}
bool VampEffectsModule::IsPluginValid(const wxString & path)
bool VampEffectsModule::IsPluginValid(const wxString & path, bool bFast)
{
int output;
bool hasParameters;
if( bFast )
return true;
auto vp = FindPlugin(path, output, hasParameters);
return bool(vp);

View File

@ -46,7 +46,7 @@ public:
wxArrayString FindPlugins(PluginManagerInterface & pm) override;
bool RegisterPlugin(PluginManagerInterface & pm, const wxString & path) override;
bool IsPluginValid(const wxString & path) override;
bool IsPluginValid(const wxString & path, bool bFast) override;
IdentInterface *CreateInstance(const wxString & path) override;
void DeleteInstance(IdentInterface *instance) override;