fix crash when zoom level leads to multiple tempo lines on the same pixel (may affect several mantis reports)

git-svn-id: svn://localhost/ardour2/branches/3.0@14015 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2013-01-27 22:42:36 +00:00
parent de4c4b5340
commit d04caca7ea

View file

@ -145,9 +145,7 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
xpos = rint(((framepos_t)(*i).frame) / (double)frames_per_unit);
if (inserted_last_time && !_lines.empty()) {
li = _lines.lower_bound(xpos); // first line >= xpos
}
line = (li != _lines.end()) ? li->second : NULL;
assert(!line || line->property_x1() == li->first);
@ -165,7 +163,6 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
line->property_color_rgba() = color;
inserted_last_time = false; // don't search next time
// Use existing line, moving if necessary
} else if (!exhausted) {
Lines::iterator steal = _lines.end();
@ -216,7 +213,8 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
// Create a new line
} else if (_lines.size() < needed || _lines.size() < MAX_CACHED_LINES) {
//cout << "*** CREATING LINE" << endl;
assert(_lines.find(xpos) == _lines.end());
/* if we already have a line there ... don't sweat it */
if (_lines.find (xpos) == _lines.end()) {
line = new ArdourCanvas::SimpleLine (*_group);
line->property_x1() = xpos;
line->property_x2() = xpos;
@ -225,11 +223,12 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
line->property_color_rgba() = color;
_lines.insert(make_pair(xpos, line));
inserted_last_time = true;
}
// Steal from the left
} else {
//cout << "*** STEALING FROM LEFT" << endl;
assert(_lines.find(xpos) == _lines.end());
if (_lines.find (xpos) == _lines.end()) {
Lines::iterator steal = _lines.begin();
double const x = steal->first;
line = steal->second;
@ -246,6 +245,7 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
_clean_right = max(_clean_right, xpos);
}
}
}
// Extend range to what we've 'fixed'
if (!invalidated) {