Fix memory leak in Stream::Close

refs #10655
This commit is contained in:
Gunnar Beutner 2016-02-03 12:56:54 +01:00
parent 9a0107d360
commit 8af6ad74c3
1 changed files with 7 additions and 0 deletions

View File

@ -76,9 +76,16 @@ bool Stream::WaitForData(int timeout)
return IsDataAvailable() || IsEof();
}
static void StreamDummyCallback(void)
{ }
void Stream::Close(void)
{
OnDataAvailable.disconnect_all_slots();
/* Force signals2 to remove the slots, see https://stackoverflow.com/questions/2049291/force-deletion-of-slot-in-boostsignals2
* for details. */
OnDataAvailable.connect(boost::bind(&StreamDummyCallback));
}
StreamReadStatus Stream::ReadLine(String *line, StreamReadContext& context, bool may_wait)