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));
}
/** 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;
}
/** A BarController which displays the value and allows control of an AutomationControl */
class AutomationController : public Gtkmm2ext::BarController {
public:
static boost::shared_ptr<AutomationController> create(
@ -51,6 +51,8 @@ public:
void display_effective_value();
void value_adjusted();
void stop_updating ();
private:
AutomationController (boost::shared_ptr<ARDOUR::AutomationControl> ac, Gtk::Adjustment* adj);
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::build_control_ui (guint32 port_index, boost::shared_ptr<AutomationControl> mcontrol)
{
ControlUI* control_ui = NULL;
if (!mcontrol)
ControlUI* control_ui = 0;
if (!mcontrol) {
return control_ui;
}
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->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)) {
control_ui->display = manage (new EventBox);
@ -749,9 +752,14 @@ GenericPluginUI::start_updating (GdkEventAny*)
bool
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 ) {
screen_update_connection.disconnect();
}
return false;
}

View File

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

View File

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

View File

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