[Summary] Fixing bug: disconnect_all did not wipe input port’s buffer.

This commit is contained in:
Valeriy Kamyshniy 2014-12-02 15:51:51 +02:00
parent 4e49f90be0
commit 33349b260d
2 changed files with 12 additions and 4 deletions

View file

@ -35,7 +35,7 @@ WavesDataPort::WavesDataPort (const std::string& inport_name, PortFlags inflags)
WavesDataPort::~WavesDataPort () WavesDataPort::~WavesDataPort ()
{ {
disconnect_all (); _disconnect_all ();
} }
@ -115,14 +115,22 @@ void WavesDataPort::_disconnect (WavesDataPort *port, bool api_call)
port->_disconnect (this, false); port->_disconnect (this, false);
} }
if (is_input() && _connections.empty()) if (is_input() && _connections.empty()) {
{
_wipe_buffer(); _wipe_buffer();
} }
} }
void WavesDataPort::disconnect_all () void WavesDataPort::disconnect_all ()
{
_disconnect_all ();
if (is_input()) {
_wipe_buffer();
}
}
void WavesDataPort::_disconnect_all ()
{ {
while (!_connections.empty ()) { while (!_connections.empty ()) {
_connections.back ()->_disconnect (this, false); _connections.back ()->_disconnect (this, false);
@ -130,7 +138,6 @@ void WavesDataPort::disconnect_all ()
} }
} }
bool WavesDataPort::is_physically_connected () const bool WavesDataPort::is_physically_connected () const
{ {
for (std::vector<WavesDataPort*>::const_iterator it = _connections.begin (); it != _connections.end (); ++it) { for (std::vector<WavesDataPort*>::const_iterator it = _connections.begin (); it != _connections.end (); ++it) {

View file

@ -106,6 +106,7 @@ private:
std::vector<WavesDataPort*> _connections; std::vector<WavesDataPort*> _connections;
void _connect (WavesDataPort* port, bool api_call); void _connect (WavesDataPort* port, bool api_call);
void _disconnect_all ();
void _disconnect (WavesDataPort* port, bool api_call); void _disconnect (WavesDataPort* port, bool api_call);
}; };