Fixed an issue where even if the communication object had Clear() called on

it, it could try and call through to an installed callback.

llvm-svn: 138146
This commit is contained in:
Greg Clayton 2011-08-19 23:28:37 +00:00
parent 59e27c5f12
commit 756f8ae520
1 changed files with 2 additions and 1 deletions

View File

@ -64,6 +64,7 @@ Communication::~Communication()
void
Communication::Clear()
{
SetReadThreadBytesReceivedCallback (NULL, NULL);
StopReadThread (NULL);
Disconnect (NULL);
}
@ -295,7 +296,7 @@ Communication::AppendBytesToCache (const uint8_t * bytes, size_t len, bool broad
// If the user registered a callback, then call it and do not broadcast
m_callback (m_callback_baton, bytes, len);
}
else
else if (bytes != NULL && len > 0)
{
Mutex::Locker locker(m_bytes_mutex);
m_bytes.append ((const char *)bytes, len);