comment tweaks from a second reading
authorPaul Davis <paul@linuxaudiosystems.com>
Sun, 9 Sep 2012 20:31:43 +0000 (20:31 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Sun, 9 Sep 2012 20:31:43 +0000 (20:31 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@13182 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/evoral/src/ControlList.cpp

index 907428af28af310d6dcab894213da81869158377..83222857ed4545645b94630276b6afcda7935fc1 100644 (file)
@@ -571,11 +571,12 @@ ControlList::add (double when, double value)
                        if (!_events.empty()) { // avoid O(N) _events.size() here
                                if (_events.back()->value == value) {
                                        EventList::iterator b = _events.end();
-                                       --b; // last point, which we know exists
-                                       if (b != _events.begin()) { // step back again, which may not be possible
-                                               --b; // next-to-last-point
+                                       --b; // final point, which we know exists
+                                       if (b != _events.begin()) { // step back again, but check first that it is legal
+                                               --b; // penultimate-point
                                                if ((*b)->value == value) {
-                                                       /* straight line - just move the last
+                                                       /* there are at least two points with the exact same value ...
+                                                        * straight line - just move the final
                                                         * point to the new time
                                                         */
                                                        _events.back()->when = when;