Fixed several MistBuffer memory management issues.
This commit is contained in:
parent
60a78c6a47
commit
b416a715ba
3 changed files with 10 additions and 0 deletions
|
@ -190,6 +190,7 @@ namespace Buffer {
|
||||||
Socket::Connection tmp = usr->S;
|
Socket::Connection tmp = usr->S;
|
||||||
usr->S = Socket::Connection( -1);
|
usr->S = Socket::Connection( -1);
|
||||||
thisStream->removeUser(usr);
|
thisStream->removeUser(usr);
|
||||||
|
thisStream->dropRing(usr->myRing);
|
||||||
delete usr;
|
delete usr;
|
||||||
return handlePushIn(tmp);
|
return handlePushIn(tmp);
|
||||||
}else{
|
}else{
|
||||||
|
@ -264,7 +265,9 @@ namespace Buffer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
usr->Disconnect("Socket closed.");
|
usr->Disconnect("Socket closed.");
|
||||||
|
thisStream->dropRing(usr->myRing);
|
||||||
thisStream->removeUser(usr);
|
thisStream->removeUser(usr);
|
||||||
|
delete usr;
|
||||||
}
|
}
|
||||||
|
|
||||||
///\brief Starts a loop, waiting for connections to send data to.
|
///\brief Starts a loop, waiting for connections to send data to.
|
||||||
|
|
|
@ -189,6 +189,12 @@ namespace Buffer {
|
||||||
tthread::lock_guard<tthread::mutex> guard(rw_mutex);
|
tthread::lock_guard<tthread::mutex> guard(rw_mutex);
|
||||||
return DTSC::Stream::getNext(pos, allowedTracks);
|
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.
|
/// Removes a track and all related buffers from the stream.
|
||||||
void Stream::removeTrack(int trackId){
|
void Stream::removeTrack(int trackId){
|
||||||
|
|
|
@ -84,6 +84,7 @@ namespace Buffer {
|
||||||
/// Logs a message to the controller.
|
/// Logs a message to the controller.
|
||||||
void Log(std::string type, std::string message);
|
void Log(std::string type, std::string message);
|
||||||
DTSC::livePos getNext(DTSC::livePos & pos, std::set<int> & allowedTracks);
|
DTSC::livePos getNext(DTSC::livePos & pos, std::set<int> & allowedTracks);
|
||||||
|
void endStream();
|
||||||
private:
|
private:
|
||||||
void deletionCallback(DTSC::livePos deleting);
|
void deletionCallback(DTSC::livePos deleting);
|
||||||
tthread::mutex rw_mutex; ///< Mutex for read/write locking.
|
tthread::mutex rw_mutex; ///< Mutex for read/write locking.
|
||||||
|
|
Loading…
Add table
Reference in a new issue