Only create a Curve for an AutomationList if we need it.

Fix crash on crossfade editor show (ticket 2442).


git-svn-id: svn://localhost/ardour2/branches/3.0@4641 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2009-02-19 19:42:25 +00:00
parent c006ff1762
commit 75c15679bf
13 changed files with 69 additions and 19 deletions

View file

@ -21,6 +21,7 @@
#include <utility>
#include <iostream>
#include "evoral/ControlList.hpp"
#include "evoral/Curve.hpp"
using namespace std;
@ -36,7 +37,7 @@ inline bool event_time_less_than (ControlEvent* a, ControlEvent* b)
ControlList::ControlList (const Parameter& id)
: _parameter(id)
, _interpolation(Linear)
, _curve(new Curve(*this))
, _curve(0)
{
_frozen = 0;
_changed_when_thawed = false;
@ -54,7 +55,7 @@ ControlList::ControlList (const Parameter& id)
ControlList::ControlList (const ControlList& other)
: _parameter(other._parameter)
, _interpolation(Linear)
, _curve(new Curve(*this))
, _curve(0)
{
_frozen = 0;
_changed_when_thawed = false;
@ -70,14 +71,14 @@ ControlList::ControlList (const ControlList& other)
for (const_iterator i = other._events.begin(); i != other._events.end(); ++i) {
_events.push_back (new ControlEvent (**i));
}
mark_dirty ();
}
ControlList::ControlList (const ControlList& other, double start, double end)
: _parameter(other._parameter)
, _interpolation(Linear)
, _curve(new Curve(*this))
, _curve(0)
{
_frozen = 0;
_changed_when_thawed = false;
@ -99,7 +100,7 @@ ControlList::ControlList (const ControlList& other, double start, double end)
_events.push_back (new ControlEvent ((*i)->when, (*i)->value));
}
}
mark_dirty ();
}
@ -147,6 +148,19 @@ ControlList::operator= (const ControlList& other)
return *this;
}
void
ControlList::create_curve()
{
_curve = new Curve(*this);
}
void
ControlList::destroy_curve()
{
delete _curve;
_curve = NULL;
}
void
ControlList::maybe_signal_changed ()
{