summaryrefslogtreecommitdiff
path: root/libs/ardour/vst_info_file.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2014-02-26 20:50:36 +0100
committerRobin Gareus <robin@gareus.org>2014-02-26 20:50:36 +0100
commit832e02a711f2df5cfd8b0fc72e2d52e524aa6cab (patch)
tree7a157ab51df019173ce89d82dfa3b88d69862ead /libs/ardour/vst_info_file.cc
parent3b8ba073fc5df98ca3426fb20706779be3352702 (diff)
properly handle VST scan/discover cancellation.
Diffstat (limited to 'libs/ardour/vst_info_file.cc')
-rw-r--r--libs/ardour/vst_info_file.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/libs/ardour/vst_info_file.cc b/libs/ardour/vst_info_file.cc
index c653c38bf1..cc0ac8431c 100644
--- a/libs/ardour/vst_info_file.cc
+++ b/libs/ardour/vst_info_file.cc
@@ -347,6 +347,13 @@ vstfx_infofile_path (const char* dllpath, int personal)
return Glib::build_filename (dir, s.str ());
}
+static void
+vstfx_remove_infofile (const char *dllpath)
+{
+ ::g_unlink(vstfx_infofile_path (dllpath, 0).c_str());
+ ::g_unlink(vstfx_infofile_path (dllpath, 1).c_str());
+}
+
static char *
vstfx_infofile_stat (const char *dllpath, struct stat* statbuf, int personal)
{
@@ -740,8 +747,6 @@ vstfx_get_info (const char* dllpath, int type, enum VSTScanMode mode)
PBD::SystemExec scanner (scanner_bin_path, argp);
PBD::ScopedConnectionList cons;
- // TODO timeout.., and honor user-terminate
- //scanner->Terminated.connect_same_thread (cons, boost::bind (&scanner_terminated))
scanner.ReadStdout.connect_same_thread (cons, boost::bind (&parse_scanner_output, _1 ,_2));
if (scanner.start (2 /* send stderr&stdout via signal */)) {
PBD::error << "Cannot launch VST scanner app '" << scanner_bin_path << "': "<< strerror(errno) << endmsg;
@@ -751,11 +756,19 @@ vstfx_get_info (const char* dllpath, int type, enum VSTScanMode mode)
while (scanner.is_running() && --timeout) {
ARDOUR::GUIIdle();
Glib::usleep (100000);
- if (ARDOUR::PluginManager::instance().cancelled()) break;
+
+ if (ARDOUR::PluginManager::instance().cancelled()) {
+ // remove info file (might be incomplete)
+ vstfx_remove_infofile(dllpath);
+ // remove temporary blacklist file (scan incomplete)
+ vstfx_un_blacklist(dllpath);
+ scanner.terminate();
+ return infos;
+ }
}
scanner.terminate();
}
- /* re-read index */
+ /* re-read index (generated by external scanner) */
vstfx_clear_info_list(infos);
if (!vstfx_check_blacklist(dllpath)) {
vstfx_get_info_from_file(dllpath, infos);