Re-work Port construction slightly so that _flags is always initialised before reset() is called. Otherwise a decision is made based on an uninitialised variable (as spotted by valgrind)

git-svn-id: svn://localhost/ardour2/trunk@2568 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2007-10-23 14:02:15 +00:00
parent 4d33fbac62
commit fc9ab1ccbd
11 changed files with 21 additions and 18 deletions

View file

@ -70,8 +70,8 @@ class AudioPort : public virtual Port {
protected:
friend class AudioEngine;
AudioPort (); // data buffer comes from elsewhere (e.g. JACK)
AudioPort (nframes_t); // data buffer owned by ardour
AudioPort (Flags); // data buffer comes from elsewhere (e.g. JACK)
AudioPort (Flags, nframes_t); // data buffer owned by ardour
void reset ();
/* engine isn't supposed to access below here */

View file

@ -51,7 +51,7 @@ class MidiPort : public virtual Port {
protected:
friend class AudioEngine;
MidiPort (nframes_t bufsize);
MidiPort (Flags, nframes_t bufsize);
/* engine isn't supposed to access below here */

View file

@ -97,7 +97,7 @@ class Port : public virtual sigc::trackable {
protected:
friend class AudioEngine;
Port ();
Port (Flags);
virtual int disconnect () = 0;
virtual void recompute_total_latency() const = 0;

View file

@ -26,15 +26,15 @@ using namespace std;
nframes_t AudioPort::_short_over_length = 2;
nframes_t AudioPort::_long_over_length = 10;
AudioPort::AudioPort()
: _buffer (0)
AudioPort::AudioPort(Flags flags)
: Port (flags), _buffer (0)
{
_type = DataType::AUDIO;
reset();
}
AudioPort::AudioPort(nframes_t nframes)
: _buffer (nframes)
AudioPort::AudioPort(Flags flags, nframes_t nframes)
: Port (flags), _buffer (nframes)
{
_type = DataType::AUDIO;
reset();

View file

@ -36,7 +36,8 @@ InternalAudioPort::default_mixdown (const list<InternalPort*>& ports, AudioBuffe
}
InternalAudioPort::InternalAudioPort(const string& name, Flags flgs)
: AudioPort (engine->frames_per_cycle())
: Port (flgs)
, AudioPort (flgs, engine->frames_per_cycle())
, InternalPort (name, DataType::AUDIO, flgs)
{
_mixdown = default_mixdown;

View file

@ -35,10 +35,10 @@ InternalPort::set_engine (AudioEngine* e)
}
InternalPort::InternalPort (const string& str, DataType type, Flags flags)
: Port (flags)
{
set_name (str);
_type = type;
_flags = flags;
}
InternalPort::~InternalPort ()

View file

@ -23,7 +23,7 @@
using namespace ARDOUR;
JackAudioPort::JackAudioPort(const std::string& name, Flags flgs)
: JackPort (name, DataType::AUDIO, flgs)
: Port (flgs), AudioPort (flgs), JackPort (name, DataType::AUDIO, flgs)
{
}

View file

@ -21,8 +21,9 @@
using namespace ARDOUR;
JackMidiPort::JackMidiPort (const std::string& name, Flags flgs)
: JackPort (name, DataType::MIDI, flgs)
, MidiPort (4096) // FIXME FIXME FIXME Jack needs to tell us this
: Port (flgs)
, JackPort (name, DataType::MIDI, flgs)
, MidiPort (flgs, 4096) // FIXME FIXME FIXME Jack needs to tell us this
, _nframes_this_cycle(0)
{
}

View file

@ -31,7 +31,7 @@ using namespace std;
AudioEngine* JackPort::engine = 0;
JackPort::JackPort (const std::string& name, DataType type, Flags flgs)
: _port (0)
: Port (flgs), _port (0)
{
_port = jack_port_register (engine->jack(), name.c_str(), type.to_jack_type(), flgs, 0);

View file

@ -25,8 +25,8 @@
using namespace ARDOUR;
using namespace std;
MidiPort::MidiPort (nframes_t bufsize)
: _buffer (bufsize)
MidiPort::MidiPort (Flags flags, nframes_t bufsize)
: Port (flags), _buffer (bufsize)
{
_type = DataType::MIDI;
reset();

View file

@ -22,8 +22,9 @@
using namespace ARDOUR;
using namespace std;
Port::Port ()
: _metering (0)
Port::Port (Flags flags)
: _flags (flags)
, _metering (0)
, _last_monitor (false)
{
}