Thought-to-be-fix for #2794; fix route process order sorting.
authorCarl Hetherington <carl@carlh.net>
Sun, 21 Nov 2010 00:51:56 +0000 (00:51 +0000)
committerCarl Hetherington <carl@carlh.net>
Sun, 21 Nov 2010 00:51:56 +0000 (00:51 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@8064 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/session.cc

index dbb899a4d4912c2f9b5091ff566ad379f421c712..f5df3a0e6be79d826029f7f11a9f4aad08bc27fe 100644 (file)
@@ -1298,10 +1298,13 @@ Session::set_default_fade (float /*steepness*/, float /*fade_msecs*/)
 }
 
 struct RouteSorter {
+    /** @return true to run r1 before r2, otherwise false */
     bool operator() (boost::shared_ptr<Route> r1, boost::shared_ptr<Route> r2) {
            if (r2->feeds (r1)) {
+                   /* r1 fed by r2; run r2 early */
                    return false;
            } else if (r1->feeds (r2)) {
+                   /* r2 fed by r1; run r1 early */
                    return true;
            } else {
                    if (r1->not_fed ()) {
@@ -1313,7 +1316,13 @@ struct RouteSorter {
                                    return true;
                            }
                    } else {
-                           return r1->order_key(N_("signal")) < r2->order_key(N_("signal"));
+                           if (r2->not_fed()) {
+                                   /* r1 has connections, r2 does not; run r2 early */
+                                   return false;
+                           } else {
+                                   /* both r1 and r2 have connections, but not to each other. just use signal order */
+                                   return r1->order_key(N_("signal")) < r2->order_key(N_("signal"));
+                           }
                    }
            }
     }