summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-03-07 14:06:19 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-03-07 14:06:19 +0000
commitb669de1e9706148d1a1386050c9f14e620e69fba (patch)
tree5929f0079248b767a3a85fd13fc39db68260820a /gtk2_ardour
parentbcd217ec8e11abcb3bc829251b6dc503d606aaeb (diff)
fix crash when renaming a track after deleting a plugin that had a visible GUI/editor window
git-svn-id: svn://localhost/ardour2/branches/3.0@4747 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/processor_box.cc40
-rw-r--r--gtk2_ardour/processor_box.h2
2 files changed, 31 insertions, 11 deletions
diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc
index 7ac5c4a598..886f594ad4 100644
--- a/gtk2_ardour/processor_box.cc
+++ b/gtk2_ardour/processor_box.cc
@@ -156,6 +156,7 @@ ProcessorBox::set_route (boost::shared_ptr<Route> r)
connections.push_back (_route->processors_changed.connect (mem_fun(*this, &ProcessorBox::redisplay_processors)));
connections.push_back (_route->GoingAway.connect (mem_fun (*this, &ProcessorBox::route_going_away)));
+ connections.push_back (_route->NameChanged.connect (mem_fun(*this, &ProcessorBox::route_name_changed)));
redisplay_processors ();
}
@@ -1118,9 +1119,6 @@ ProcessorBox::edit_processor (boost::shared_ptr<Processor> processor)
plugin_insert->set_gui (plugin_ui);
- // change window title when route name is changed
- _route->NameChanged.connect (bind (mem_fun(*this, &ProcessorBox::route_name_changed), plugin_ui, boost::weak_ptr<PluginInsert> (plugin_insert)));
-
} else {
plugin_ui = reinterpret_cast<PluginUIWindow *> (plugin_insert->get_gui());
plugin_ui->set_parent (win);
@@ -1378,16 +1376,38 @@ ProcessorBox::rb_edit ()
}
void
-ProcessorBox::route_name_changed (PluginUIWindow* plugin_ui, boost::weak_ptr<PluginInsert> wpi)
+ProcessorBox::route_name_changed ()
{
- ENSURE_GUI_THREAD(bind (mem_fun (*this, &ProcessorBox::route_name_changed), plugin_ui, wpi));
+ ENSURE_GUI_THREAD (mem_fun (*this, &ProcessorBox::route_name_changed));
+
+ boost::shared_ptr<Processor> processor;
+ boost::shared_ptr<PluginInsert> plugin_insert;
+ boost::shared_ptr<Send> send;
+
+ Gtk::TreeModel::Children children = model->children();
+
+ for (Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) {
+ Gtk::TreeModel::Row row = *iter;
+
+ processor= row[columns.processor];
+
+ void* gui = processor->get_gui();
+
+ if (!gui) {
+ continue;
+ }
- boost::shared_ptr<PluginInsert> pi (wpi.lock());
+ /* rename editor windows for sends and plugins */
- if (pi) {
- WindowTitle title(Glib::get_application_name());
- title += generate_processor_title (pi);
- plugin_ui->set_title (title.get_string());
+ WindowTitle title (Glib::get_application_name());
+
+ if ((send = boost::dynamic_pointer_cast<Send> (processor)) != 0) {
+ title += send->name();
+ static_cast<Window*>(gui)->set_title (title.get_string());
+ } else if ((plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (processor)) != 0) {
+ title += generate_processor_title (plugin_insert);
+ static_cast<Window*>(gui)->set_title (title.get_string());
+ }
}
}
diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h
index c04498a599..60836ac1f6 100644
--- a/gtk2_ardour/processor_box.h
+++ b/gtk2_ardour/processor_box.h
@@ -222,7 +222,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject
static void rb_ab_plugins ();
static void rb_edit ();
- void route_name_changed (PluginUIWindow* plugin_ui, boost::weak_ptr<ARDOUR::PluginInsert> pi);
+ void route_name_changed ();
std::string generate_processor_title (boost::shared_ptr<ARDOUR::PluginInsert> pi);
};