Fixed several MistBuffer memory management issues.

This commit is contained in:
Thulinma 2014-01-29 16:44:18 +01:00
parent 60a78c6a47
commit b416a715ba
3 changed files with 10 additions and 0 deletions

View file

@ -190,6 +190,7 @@ namespace Buffer {
Socket::Connection tmp = usr->S;
usr->S = Socket::Connection( -1);
thisStream->removeUser(usr);
thisStream->dropRing(usr->myRing);
delete usr;
return handlePushIn(tmp);
}else{
@ -264,7 +265,9 @@ namespace Buffer {
}
}
usr->Disconnect("Socket closed.");
thisStream->dropRing(usr->myRing);
thisStream->removeUser(usr);
delete usr;
}
///\brief Starts a loop, waiting for connections to send data to.

View file

@ -189,6 +189,12 @@ namespace Buffer {
tthread::lock_guard<tthread::mutex> guard(rw_mutex);
return DTSC::Stream::getNext(pos, allowedTracks);
}
/// endStream override that will lock the rw_mutex
void Stream::endStream(){
tthread::lock_guard<tthread::mutex> guard(rw_mutex);
return DTSC::Stream::endStream();
}
/// Removes a track and all related buffers from the stream.
void Stream::removeTrack(int trackId){

View file

@ -84,6 +84,7 @@ namespace Buffer {
/// Logs a message to the controller.
void Log(std::string type, std::string message);
DTSC::livePos getNext(DTSC::livePos & pos, std::set<int> & allowedTracks);
void endStream();
private:
void deletionCallback(DTSC::livePos deleting);
tthread::mutex rw_mutex; ///< Mutex for read/write locking.