summaryrefslogtreecommitdiff
path: root/audio/ardour/tempoline_crash.patch
blob: cd93b1531beb081d3f89923357b28e04a5db7442 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
commit b29f54fb6efcdb2facf0471bd8e24d8eea3231b0
Author: Paul Davis <paul@linuxaudiosystems.com>
Date:   Wed Feb 20 18:53:30 2013 +0000

    back-port tempo line assert fix from 3.0 to stop crashing under some relatively easy to hit conditions
    
    git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@14067 d708f5d6-7413-0410-9779-e7cbd77b26cf

diff --git a/gtk2_ardour/tempo_lines.cc b/gtk2_ardour/tempo_lines.cc
index e8bd034..a373dec 100644
--- a/gtk2_ardour/tempo_lines.cc
+++ b/gtk2_ardour/tempo_lines.cc
@@ -146,9 +146,8 @@ TempoLines::draw (ARDOUR::TempoMap::BBTPointList& points, double frames_per_unit
 			}
 
 			xpos = rint(((nframes64_t)(*i).frame) / (double)frames_per_unit);
-			if (inserted_last_time && !_lines.empty()) {
-				li = _lines.lower_bound(xpos); // first line >= xpos
-			}
+
+                        li = _lines.lower_bound(xpos); // first line >= xpos
                              
 			line = (li != _lines.end()) ? li->second : NULL;
 			assert(!line || line->property_x1() == li->first);
@@ -215,33 +214,35 @@ TempoLines::draw (ARDOUR::TempoMap::BBTPointList& points, double frames_per_unit
 				// Create a new line
 			} else if (_lines.size() < needed || _lines.size() < MAX_CACHED_LINES) {
 				//cout << "*** CREATING LINE" << endl;
-				assert(_lines.find(xpos) == _lines.end());
-				line = new ArdourCanvas::SimpleLine (*_group);
-				line->property_x1() = xpos;
-				line->property_x2() = xpos;
-				line->property_y1() = 0.0;
-				line->property_y2() = _height;
-				line->property_color_rgba() = color;
-				_lines.insert(make_pair(xpos, line));
-				inserted_last_time = true;
+				if (_lines.find(xpos) == _lines.end()) {
+                                        line = new ArdourCanvas::SimpleLine (*_group);
+                                        line->property_x1() = xpos;
+                                        line->property_x2() = xpos;
+                                        line->property_y1() = 0.0;
+                                        line->property_y2() = _height;
+                                        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());
-				Lines::iterator steal = _lines.begin();
-				line = steal->second;
-				_lines.erase(steal);
-				line->property_color_rgba() = color;
-				line->property_x1() = xpos;
-				line->property_x2() = xpos;
-				_lines.insert(make_pair(xpos, line));
-				inserted_last_time = true; // search next time
-				invalidated = true;
-                               
-				// Shift clean range right
-				_clean_left = max(_clean_left, steal->first);
-				_clean_right = max(_clean_right, xpos);
+				if (_lines.find(xpos) == _lines.end()) {
+                                        Lines::iterator steal = _lines.begin();
+                                        line = steal->second;
+                                        _lines.erase(steal);
+                                        line->property_color_rgba() = color;
+                                        line->property_x1() = xpos;
+                                        line->property_x2() = xpos;
+                                        _lines.insert(make_pair(xpos, line));
+                                        inserted_last_time = true; // search next time
+                                        invalidated = true;
+                                        
+                                        // Shift clean range right
+                                        _clean_left = max(_clean_left, steal->first);
+                                        _clean_right = max(_clean_right, xpos);
+                                }
 			}
 
 			break;