fix a huge mess with sends, involving incorrect GUI cleanup, an unhandled exception and as a result, bad reference counting of sends leading to ports never going away because the send was never deleted

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3484 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2008-06-19 20:38:19 +00:00
parent 82031d05e0
commit 422607acfe
4 changed files with 24 additions and 9 deletions

View file

@ -496,7 +496,12 @@ RedirectBox::choose_send ()
/* XXX need redirect lock on route */
send->ensure_io (0, _route->max_redirect_outs(), false, this);
try {
send->ensure_io (0, _route->max_redirect_outs(), false, this);
} catch (AudioEngine::PortRegistrationFailure& err) {
error << string_compose (_("Cannot set up new send: %1"), err.what()) << endmsg;
return;
}
IOSelectorWindow *ios = new IOSelectorWindow (_session, send, false, true);
@ -854,6 +859,13 @@ RedirectBox::idle_delete_redirect (boost::weak_ptr<Redirect> weak_redirect)
/* NOT copied to _mixer.selection() */
no_redirect_redisplay = true;
void* gui = redirect->get_gui ();
if (gui) {
static_cast<Gtk::Widget*>(gui)->hide ();
}
_route->remove_redirect (redirect, this);
no_redirect_redisplay = false;
redisplay_redirects (this);

View file

@ -44,7 +44,7 @@ SendUI::SendUI (boost::shared_ptr<Send> s, Session& se)
vbox.pack_start (hbox, false, false, false);
vbox.pack_start (panners, false,false);
io = new IOSelector (se, s, false);
io = manage (new IOSelector (se, s, false));
pack_start (vbox, false, false);
@ -70,7 +70,7 @@ SendUI::SendUI (boost::shared_ptr<Send> s, Session& se)
SendUI::~SendUI ()
{
_send->set_metering (false);
/* XXX not clear that we need to do this */
screen_update_connection.disconnect();
@ -121,8 +121,8 @@ SendUIWindow::SendUIWindow (boost::shared_ptr<Send> s, Session& ss)
add (vpacker);
set_name ("SendUIWindow");
s->GoingAway.connect (mem_fun (*this, &SendUIWindow::send_going_away));
going_away_connection = s->GoingAway.connect (mem_fun (*this, &SendUIWindow::send_going_away));
signal_delete_event().connect (bind (ptr_fun (just_hide_it), reinterpret_cast<Window *> (this)));
@ -138,5 +138,6 @@ SendUIWindow::send_going_away ()
{
ENSURE_GUI_THREAD (mem_fun (*this, &SendUIWindow::send_going_away));
delete_when_idle (this);
going_away_connection.disconnect ();
}

View file

@ -42,6 +42,8 @@ class SendUI : public Gtk::HBox
IOSelector* io;
boost::shared_ptr<ARDOUR::Send>& send() { return _send; }
private:
boost::shared_ptr<ARDOUR::Send> _send;
ARDOUR::Session& _session;
@ -70,6 +72,7 @@ class SendUIWindow : public Gtk::Window
Gtk::HBox hpacker;
void send_going_away ();
sigc::connection going_away_connection;
};
#endif /* __ardour_gtk_send_ui_h__ */

View file

@ -1092,19 +1092,18 @@ Route::remove_redirect (boost::shared_ptr<Redirect> redirect, void *src, uint32_
return -1;
}
bool foo = false;
_have_internal_generator = false;
for (i = _redirects.begin(); i != _redirects.end(); ++i) {
boost::shared_ptr<PluginInsert> pi;
if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) {
if (pi->is_generator()) {
foo = true;
_have_internal_generator = true;
break;
}
}
}
_have_internal_generator = foo;
}
if (old_rmo != redirect_max_outs) {