Fix crash when adding automation tracks caused by route ordering.
I have no idea what caused this, or whether this is a kludge or not, but it's certainly less crap than not being able to display automation whatsoever. git-svn-id: svn://localhost/ardour2/branches/3.0@5877 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
862bbd4569
commit
bcf885b4be
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <map>
|
||||||
#include <sigc++/bind.h>
|
#include <sigc++/bind.h>
|
||||||
|
|
||||||
#include <gtkmm/accelmap.h>
|
#include <gtkmm/accelmap.h>
|
||||||
@ -374,7 +375,6 @@ Mixer_UI::remove_strip (MixerStrip* strip)
|
|||||||
void
|
void
|
||||||
Mixer_UI::sync_order_keys (string const & src)
|
Mixer_UI::sync_order_keys (string const & src)
|
||||||
{
|
{
|
||||||
vector<int> neworder;
|
|
||||||
TreeModel::Children rows = track_model->children();
|
TreeModel::Children rows = track_model->children();
|
||||||
TreeModel::Children::iterator ri;
|
TreeModel::Children::iterator ri;
|
||||||
|
|
||||||
@ -382,25 +382,30 @@ Mixer_UI::sync_order_keys (string const & src)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
std::map<int,int> keys;
|
||||||
neworder.push_back (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
unsigned int order;
|
|
||||||
|
|
||||||
for (order = 0, ri = rows.begin(); ri != rows.end(); ++ri, ++order) {
|
unsigned order = 0;
|
||||||
|
for (ri = rows.begin(); ri != rows.end(); ++ri, ++order) {
|
||||||
boost::shared_ptr<Route> route = (*ri)[track_columns.route];
|
boost::shared_ptr<Route> route = (*ri)[track_columns.route];
|
||||||
unsigned int old_key = order;
|
unsigned int old_key = order;
|
||||||
unsigned int new_key = route->order_key (N_("signal"));
|
unsigned int new_key = route->order_key (N_("signal"));
|
||||||
|
|
||||||
assert (new_key < neworder.size());
|
keys[new_key] = old_key;
|
||||||
neworder[new_key] = old_key;
|
|
||||||
|
|
||||||
if (new_key != old_key) {
|
if (new_key != old_key) {
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
assert(keys.size() == rows.size());
|
||||||
|
|
||||||
|
// Remove any gaps in keys caused by automation children tracks
|
||||||
|
vector<int> neworder;
|
||||||
|
for (std::map<int,int>::const_iterator i = keys.begin(); i != keys.end(); ++i) {
|
||||||
|
neworder.push_back(i->second);
|
||||||
|
}
|
||||||
|
assert(neworder.size() == rows.size());
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
strip_redisplay_does_not_reset_order_keys = true;
|
strip_redisplay_does_not_reset_order_keys = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user