API to delete AU cache & blacklist
authorRobin Gareus <robin@gareus.org>
Sat, 28 Feb 2015 14:51:06 +0000 (15:51 +0100)
committerRobin Gareus <robin@gareus.org>
Sat, 28 Feb 2015 14:52:28 +0000 (15:52 +0100)
libs/ardour/ardour/plugin_manager.h
libs/ardour/plugin_manager.cc

index 31ab833508d853953b46ac0799e4f573bae9bb40..3a6a210b5f4720e9ff875c32fd00f50234a31571 100644 (file)
@@ -56,6 +56,8 @@ class LIBARDOUR_API PluginManager : public boost::noncopyable {
        void cancel_plugin_timeout();
        void clear_vst_cache ();
        void clear_vst_blacklist ();
+       void clear_au_cache ();
+       void clear_au_blacklist ();
 
        const std::string get_default_windows_vst_path() const { return windows_vst_path; }
        const std::string get_default_lxvst_path() const { return lxvst_path; }
index 01853ccdb38ecd8a4e328068430b36e60da0ee06..2fc84d367971ea6f371adff1be4169d2621012d9 100644 (file)
@@ -49,6 +49,8 @@
 #include <glib/gstdio.h>
 #include <glibmm/miscutils.h>
 #include <glibmm/pattern.h>
+#include <glibmm/fileutils.h>
+#include <glibmm/miscutils.h>
 
 #include "pbd/whitespace.h"
 #include "pbd/file_utils.h"
@@ -341,6 +343,29 @@ PluginManager::clear_vst_blacklist ()
 #endif
 }
 
+void
+PluginManager::clear_au_cache ()
+{
+#ifdef AUDIOUNIT_SUPPORT
+       // AUPluginInfo::au_cache_path ()
+       string fn = Glib::build_filename (ARDOUR::user_config_directory(), "au_cache");
+       if (Glib::file_test (fn, Glib::FILE_TEST_EXISTS)) {
+               ::g_unlink(fn.c_str());
+       }
+#endif
+}
+
+void
+PluginManager::clear_au_blacklist ()
+{
+#ifdef AUDIOUNIT_SUPPORT
+       string fn = Glib::build_filename (ARDOUR::user_cache_directory(), "au_blacklist.txt");
+       if (Glib::file_test (fn, Glib::FILE_TEST_EXISTS)) {
+               ::g_unlink(fn.c_str());
+       }
+#endif
+}
+
 void
 PluginManager::ladspa_refresh ()
 {
@@ -623,6 +648,19 @@ PluginManager::au_refresh (bool cache_only)
        Config->set_discover_audio_units (false);
        Config->save_state();
 
+       /* note: AU require a CAComponentDescription pointer provided by the OS.
+        * Ardour only caches port and i/o config. It can't just 'scan' without
+        * 'discovering' (like we do for VST).
+        *
+        * So in case discovery fails, we assume the worst: the Description
+        * is broken (malicious plugins) and even a simple 'scan' would always
+        * crash ardour on startup. Hence we disable Auto-Scan on start.
+        *
+        * If the crash happens at any later time (description is available),
+        * Ardour will blacklist the plugin in question -- unless
+        * the crash happens during realtime-run.
+        */
+
        _au_plugin_info = AUPluginInfo::discover();
 
        // successful scan re-enabled automatic discovery