buffer_stream: do not crash on shutdown

When destructing the users, they attempt to drop the ring they own. This works
by checking Strm's list of rings. But when Strm is destructed, all rings are
deleted as well which results in a segfault.
This commit is contained in:
Peter Wu 2012-08-25 19:49:19 +02:00
parent e6179904c7
commit 90e1ba7308

View file

@ -27,7 +27,6 @@ Buffer::Stream::Stream(){
/// Do cleanup on delete. /// Do cleanup on delete.
Buffer::Stream::~Stream(){ Buffer::Stream::~Stream(){
delete Strm;
while (users.size() > 0){ while (users.size() > 0){
stats_mutex.lock(); stats_mutex.lock();
for (usersIt = users.begin(); usersIt != users.end(); usersIt++){ for (usersIt = users.begin(); usersIt != users.end(); usersIt++){
@ -42,6 +41,7 @@ Buffer::Stream::~Stream(){
moreData.notify_all(); moreData.notify_all();
cleanUsers(); cleanUsers();
} }
delete Strm;
} }
/// Calculate and return the current statistics in JSON format. /// Calculate and return the current statistics in JSON format.