Stop crash on deleting a plugin when its generic UI window is open.

git-svn-id: svn://localhost/ardour2/branches/3.0@6626 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-02-03 00:52:45 +00:00
parent faa2b3a3ad
commit c3bfc3ec4e
6 changed files with 26 additions and 8 deletions

View file

@ -150,3 +150,9 @@ AutomationController::value_changed ()
Gtkmm2ext::UI::instance()->call_slot (boost::bind (&AutomationController::display_effective_value, this)); Gtkmm2ext::UI::instance()->call_slot (boost::bind (&AutomationController::display_effective_value, this));
} }
/** Stop updating our value from our controllable */
void
AutomationController::stop_updating ()
{
_screen_update_connection.disconnect ();
}

View file

@ -34,7 +34,7 @@ namespace ARDOUR {
class Automatable; class Automatable;
} }
/** A BarController which displays the value and allows control of an AutomationControl */
class AutomationController : public Gtkmm2ext::BarController { class AutomationController : public Gtkmm2ext::BarController {
public: public:
static boost::shared_ptr<AutomationController> create( static boost::shared_ptr<AutomationController> create(
@ -51,6 +51,8 @@ public:
void display_effective_value(); void display_effective_value();
void value_adjusted(); void value_adjusted();
void stop_updating ();
private: private:
AutomationController (boost::shared_ptr<ARDOUR::AutomationControl> ac, Gtk::Adjustment* adj); AutomationController (boost::shared_ptr<ARDOUR::AutomationControl> ac, Gtk::Adjustment* adj);
std::string get_label (int&); std::string get_label (int&);

View file

@ -381,9 +381,10 @@ GenericPluginUI::print_parameter (char *buf, uint32_t len, uint32_t param)
GenericPluginUI::ControlUI* GenericPluginUI::ControlUI*
GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<AutomationControl> mcontrol) GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<AutomationControl> mcontrol)
{ {
ControlUI* control_ui = NULL; ControlUI* control_ui = 0;
if (!mcontrol) if (!mcontrol) {
return control_ui; return control_ui;
}
Plugin::ParameterDescriptor desc; Plugin::ParameterDescriptor desc;
@ -545,6 +546,8 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<Automat
mcontrol->Changed.connect (control_connections, boost::bind (&GenericPluginUI::parameter_changed, this, control_ui), gui_context()); mcontrol->Changed.connect (control_connections, boost::bind (&GenericPluginUI::parameter_changed, this, control_ui), gui_context());
mcontrol->alist()->automation_state_changed.connect (control_connections, boost::bind (&GenericPluginUI::automation_state_changed, this, control_ui), gui_context()); mcontrol->alist()->automation_state_changed.connect (control_connections, boost::bind (&GenericPluginUI::automation_state_changed, this, control_ui), gui_context());
input_controls.push_back (control_ui);
} else if (plugin->parameter_is_output (port_index)) { } else if (plugin->parameter_is_output (port_index)) {
control_ui->display = manage (new EventBox); control_ui->display = manage (new EventBox);
@ -749,9 +752,14 @@ GenericPluginUI::start_updating (GdkEventAny*)
bool bool
GenericPluginUI::stop_updating (GdkEventAny*) GenericPluginUI::stop_updating (GdkEventAny*)
{ {
for (vector<ControlUI*>::iterator i = input_controls.begin(); i != input_controls.end(); ++i) {
(*i)->controller->stop_updating ();
}
if (output_controls.size() > 0 ) { if (output_controls.size() > 0 ) {
screen_update_connection.disconnect(); screen_update_connection.disconnect();
} }
return false; return false;
} }

View file

@ -120,7 +120,7 @@ PluginUIWindow::PluginUIWindow (Gtk::Window* win, boost::shared_ptr<PluginInsert
GenericPluginUI* pu = new GenericPluginUI (insert, scrollable); GenericPluginUI* pu = new GenericPluginUI (insert, scrollable);
_pluginui = pu; _pluginui = pu;
add( *pu ); add (*pu);
/* /*
Gtk::HBox *hbox = new Gtk::HBox(); Gtk::HBox *hbox = new Gtk::HBox();

View file

@ -214,6 +214,7 @@ class GenericPluginUI : public PlugUIBase, public Gtk::VBox
~ControlUI(); ~ControlUI();
}; };
std::vector<ControlUI*> input_controls;
std::vector<ControlUI*> output_controls; std::vector<ControlUI*> output_controls;
sigc::connection screen_update_connection; sigc::connection screen_update_connection;
void output_update(); void output_update();

View file

@ -432,11 +432,12 @@ PluginInsert::set_parameter (Evoral::Parameter param, float val)
float float
PluginInsert::get_parameter (Evoral::Parameter param) PluginInsert::get_parameter (Evoral::Parameter param)
{ {
if (param.type() != PluginAutomation) if (param.type() != PluginAutomation) {
return 0.0; return 0.0;
else } else {
return assert (!_plugins.empty ());
_plugins[0]->get_parameter (param.id()); return _plugins[0]->get_parameter (param.id());
}
} }
void void