13
0

improve clean-up of GUI VCA-related objects

This commit is contained in:
Paul Davis 2016-04-23 18:25:49 -04:00
parent be4e898996
commit b4c43f0878
3 changed files with 40 additions and 1 deletions

View File

@ -385,6 +385,8 @@ Mixer_UI::add_masters (VCAList& vcas)
row[track_columns.text] = (*v)->name();
row[track_columns.visible] = true;
row[track_columns.vca] = vms;
vms->CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_master, this, _1), gui_context());
}
redisplay_track_list ();
@ -393,6 +395,21 @@ Mixer_UI::add_masters (VCAList& vcas)
void
Mixer_UI::remove_master (VCAMasterStrip* vms)
{
if (_session && _session->deletion_in_progress()) {
/* its all being taken care of */
return;
}
TreeModel::Children rows = track_model->children();
TreeModel::Children::iterator ri;
for (ri = rows.begin(); ri != rows.end(); ++ri) {
if ((*ri)[track_columns.vca] == vms) {
PBD::Unwinder<bool> uw (_route_deletion_in_progress, true);
track_model->erase (ri);
break;
}
}
}
void

View File

@ -39,6 +39,8 @@ using namespace Gtk;
using namespace PBD;
using std::string;
PBD::Signal1<void,VCAMasterStrip*> VCAMasterStrip::CatchDeletion;
VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
: AxisView (s)
, _vca (v)
@ -139,6 +141,21 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
invalidator (*this),
boost::bind (&VCAMasterStrip::update_vca_display, this),
gui_context());
_vca->DropReferences.connect (vca_connections, invalidator (*this), boost::bind (&VCAMasterStrip::self_delete, this), gui_context());
}
VCAMasterStrip::~VCAMasterStrip ()
{
CatchDeletion (this); /* EMIT SIGNAL */
}
void
VCAMasterStrip::self_delete ()
{
delete this;
}
void

View File

@ -44,7 +44,11 @@ class VCAMasterStrip : public AxisView, public Gtk::EventBox
std::string state_id() const { return "VCAMasterStrip"; }
boost::shared_ptr<ARDOUR::VCA> vca() const { return _vca; }
private:
static PBD::Signal1<void,VCAMasterStrip*> CatchDeletion;
private:
~VCAMasterStrip ();
boost::shared_ptr<ARDOUR::VCA> _vca;
Gtk::HBox vertical_padding;
ArdourButton name_button;
@ -84,6 +88,7 @@ class VCAMasterStrip : public AxisView, public Gtk::EventBox
void vca_property_changed (PBD::PropertyChange const & what_changed);
void update_vca_name ();
void build_context_menu ();
void self_delete ();
};