summaryrefslogtreecommitdiff
path: root/gtk2_ardour/linux_vst_gui_support.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-04-27 23:33:28 +0200
committerRobin Gareus <robin@gareus.org>2016-04-27 23:34:55 +0200
commitc8a46a65025e16c5c5254b57e2a4c42354237325 (patch)
tree0cc569254efeeed155c22b4b0489b2a9576b8acf /gtk2_ardour/linux_vst_gui_support.cc
parentb3e12d65662d0747271c409931301b928486209f (diff)
some linuxVST GUI details: initialize lock, add a note.
Diffstat (limited to 'gtk2_ardour/linux_vst_gui_support.cc')
-rw-r--r--gtk2_ardour/linux_vst_gui_support.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/gtk2_ardour/linux_vst_gui_support.cc b/gtk2_ardour/linux_vst_gui_support.cc
index c86fb946cc..a2f637a26c 100644
--- a/gtk2_ardour/linux_vst_gui_support.cc
+++ b/gtk2_ardour/linux_vst_gui_support.cc
@@ -56,7 +56,7 @@ static VSTState * vstfx_first = NULL;
const char magic[] = "VSTFX Plugin State v002";
-static int gui_quit = 0;
+static volatile int gui_quit = 0;
/*This will be our connection to X*/
@@ -471,7 +471,7 @@ again:
clock1 = g_get_monotonic_time();
}
- if (may_sleep && elapsed_time_ms + 1 < LXVST_sched_timer_interval) {
+ if (!gui_quit && may_sleep && elapsed_time_ms + 1 < LXVST_sched_timer_interval) {
Glib::usleep(1000 * (LXVST_sched_timer_interval - elapsed_time_ms - 1));
}
}
@@ -487,6 +487,8 @@ normally started in globals.cc*/
int vstfx_init (void* ptr)
{
+ assert (gui_quit == 0);
+ pthread_mutex_init (&plugin_mutex, NULL);
int thread_create_result;
@@ -553,7 +555,11 @@ void vstfx_exit()
/*We need to pthread_join the gui_thread here so
we know when it has stopped*/
+ // BEWARE: some Plugin GUIs can crash if the thread local storage is free()d
+ // after the shared library containing the destructor is already dl-closed.
+ // (e.g u-he LXVST GUI, crash in __nptl_deallocate_tsd) :(
pthread_join(LXVST_gui_event_thread, NULL);
+ pthread_mutex_destroy (&plugin_mutex);
}
/*Adds a new plugin (VSTFX) instance to the linked list*/