summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-11-28 20:03:16 -0500
committerDavid Robillard <d@drobilla.net>2014-11-28 20:04:57 -0500
commite55b68298bbc820734532129be908459813acb8d (patch)
tree52dd9e23c2cc83fe4ad449f0f8123f5f57076267 /libs
parent55c616519bc4cc0ad0095ada7a0fc1909196818b (diff)
Fix crash when deleting all points from a line.
Diffstat (limited to 'libs')
-rw-r--r--libs/evoral/src/ControlList.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/libs/evoral/src/ControlList.cpp b/libs/evoral/src/ControlList.cpp
index 37e79d70d3..8c98491638 100644
--- a/libs/evoral/src/ControlList.cpp
+++ b/libs/evoral/src/ControlList.cpp
@@ -64,6 +64,7 @@ ControlList::ControlList (const Parameter& id)
_default_value = id.normal();
_lookup_cache.left = -1;
_lookup_cache.range.first = _events.end();
+ _lookup_cache.range.second = _events.end();
_search_cache.left = -1;
_search_cache.first = _events.end();
_sort_pending = false;
@@ -85,6 +86,7 @@ ControlList::ControlList (const ControlList& other)
_max_yval = other._max_yval;
_default_value = other._default_value;
_lookup_cache.range.first = _events.end();
+ _lookup_cache.range.second = _events.end();
_search_cache.first = _events.end();
_sort_pending = false;
new_write_pass = true;
@@ -109,6 +111,7 @@ ControlList::ControlList (const ControlList& other, double start, double end)
_max_yval = other._max_yval;
_default_value = other._default_value;
_lookup_cache.range.first = _events.end();
+ _lookup_cache.range.second = _events.end();
_search_cache.first = _events.end();
_sort_pending = false;
@@ -935,7 +938,10 @@ void
ControlList::mark_dirty () const
{
_lookup_cache.left = -1;
+ _lookup_cache.range.first = _events.end();
+ _lookup_cache.range.second = _events.end();
_search_cache.left = -1;
+ _search_cache.first = _events.end();
if (_curve) {
_curve->mark_dirty();
@@ -1283,7 +1289,10 @@ ControlList::build_search_cache_if_necessary (double start) const
{
/* Only do the range lookup if x is in a different range than last time
* this was called (or if the search cache has been marked "dirty" (left<0) */
- if (!_events.empty() && ((_search_cache.left < 0) || (_search_cache.left > start))) {
+ if (_events.empty()) {
+ _search_cache.first = _events.end();
+ _search_cache.left = 0;
+ } else if ((_search_cache.left < 0) || (_search_cache.left > start)) {
const ControlEvent start_point (start, 0);