summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-02-03 03:26:39 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-02-03 03:26:39 +0000
commite7032972a234ef8dab18e2115abc6f6d48d32016 (patch)
tree31b6649f4d92553ac26089847243694380ecdcfd /gtk2_ardour
parentbc7dc158c4b4d1e958474b7ace1e0079ed2dbe45 (diff)
register foreign LV2 external UI threads with GUI to avoid crashing when they try to notify ardour's GUI thread of parameter changes
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@8685 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/lv2_plugin_ui.cc17
-rw-r--r--gtk2_ardour/lv2_plugin_ui.h4
2 files changed, 17 insertions, 4 deletions
diff --git a/gtk2_ardour/lv2_plugin_ui.cc b/gtk2_ardour/lv2_plugin_ui.cc
index 5c93aa0d59..de37185198 100644
--- a/gtk2_ardour/lv2_plugin_ui.cc
+++ b/gtk2_ardour/lv2_plugin_ui.cc
@@ -18,9 +18,13 @@
*/
+#include <pbd/pthread_utils.h>
+
#include <ardour/insert.h>
#include <ardour/lv2_plugin.h>
+#include <gtkmm2ext/gtk_ui.h>
+
#include "ardour_ui.h"
#include "lv2_plugin_ui.h"
#include "gui_thread.h"
@@ -36,10 +40,18 @@ LV2PluginUI::lv2_ui_write(LV2UI_Controller controller,
uint32_t format,
const void* buffer)
{
- //cout << "lv2_ui_write" << endl;
LV2PluginUI* me = (LV2PluginUI*)controller;
+
+ cout << "lv2_ui_write, thread registered ? " << me->_thread_registered << endl;
+
+ if (!me->_thread_registered && !Gtkmm2ext::UI::instance()->caller_is_ui_thread()) {
+ cerr << "Registering LV2 external thread " << pthread_self() << endl;
+ PBD::notify_gui_about_thread_creation (pthread_self(), me->_lv2->name());
+ me->_thread_registered = true;
+ }
+
if (*(float*)buffer != me->_values[port_index]) {
- //cout << "set_parameter " << port_index << ":" << *(float*)buffer << endl;
+ cout << "set_parameter " << port_index << ":" << *(float*)buffer << endl;
me->_lv2->set_parameter(port_index, *(float*)buffer);
}
}
@@ -123,6 +135,7 @@ LV2PluginUI::output_update()
LV2PluginUI::LV2PluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_ptr<LV2Plugin> lv2p)
: PlugUIBase (pi)
, _lv2(lv2p)
+ , _thread_registered (false)
, _inst(NULL)
, _values(NULL)
, _external_ui_ptr(NULL)
diff --git a/gtk2_ardour/lv2_plugin_ui.h b/gtk2_ardour/lv2_plugin_ui.h
index 9bb1fe60ae..9400aa6a00 100644
--- a/gtk2_ardour/lv2_plugin_ui.h
+++ b/gtk2_ardour/lv2_plugin_ui.h
@@ -58,11 +58,11 @@ class LV2PluginUI : public PlugUIBase, public Gtk::VBox
boost::shared_ptr<ARDOUR::LV2Plugin> _lv2;
std::vector<int> _output_ports;
sigc::connection _screen_update_connection;
-
+ bool _thread_registered;
Gtk::Widget* _gui_widget;
SLV2UIInstance _inst;
float* _values;
-
+
struct lv2_external_ui_host _external_ui_host;
LV2_Feature _external_ui_feature;
struct lv2_external_ui* _external_ui_ptr;