From 4d65fab78f6cab45909e422fa4a3af8dad9b57ac Mon Sep 17 00:00:00 2001
From: Tim Blechmann <tim@klingt.org>
Date: Thu, 24 Apr 2008 20:40:33 +0200
Subject: [PATCH] possible fix for bug no 2203

---
 libs/ardour/route.cc |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index dcf78b5..478b385 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -862,14 +862,6 @@ Route::add_redirect (boost::shared_ptr<Redirect> redirect, void *src, uint32_t*
 		boost::shared_ptr<PluginInsert> pi;
 		boost::shared_ptr<PortInsert> porti;
 
-		_redirects.push_back (redirect);
-
-		if (_reset_plugin_counts (err_streams)) {
-			_redirects.pop_back ();
-			_reset_plugin_counts (0); // it worked before we tried to add it ...
-			return -1;
-		}
-
 		uint32_t potential_max_streams = 0;
 
 		if ((pi = boost::dynamic_pointer_cast<PluginInsert>(redirect)) != 0) {
@@ -910,6 +902,14 @@ Route::add_redirect (boost::shared_ptr<Redirect> redirect, void *src, uint32_t*
 			_max_peak_power.push_back(-INFINITY);
 		}
 
+		_redirects.push_back (redirect);
+
+		if (_reset_plugin_counts (err_streams)) {
+			_redirects.pop_back ();
+			_reset_plugin_counts (0); // it worked before we tried to add it ...
+			return -1;
+		}
+
 		redirect->activate ();
 		redirect->active_changed.connect (mem_fun (*this, &Route::redirect_active_proxy));
 	}
-- 
1.5.5

