Fixed a segfault in the buffer on track deletion, added a WARN-level message when/if something similar occurs.

This commit is contained in:
Thulinma 2016-05-01 15:56:10 +02:00
parent 4c1760f5f7
commit aa2dd8491c
2 changed files with 15 additions and 8 deletions

View file

@ -1116,6 +1116,9 @@ namespace IPC {
userConnection::userConnection(char * _data) { userConnection::userConnection(char * _data) {
data = _data; data = _data;
if (!data){
WARN_MSG("userConnection created with null pointer!");
}
} }
unsigned long userConnection::getTrackId(size_t offset) const { unsigned long userConnection::getTrackId(size_t offset) const {

View file

@ -515,6 +515,9 @@ namespace Mist {
bufferLocations[tid].erase(bufferLocations[tid].begin()); bufferLocations[tid].erase(bufferLocations[tid].begin());
} }
if (pushLocation.count(it->first)) { if (pushLocation.count(it->first)) {
// \todo Debugger says this is null sometimes. It shouldn't be. Figure out why!
// For now, this if will prevent crashes in these cases.
if (pushLocation[it->first]){
//Reset the userpage, to allow repushing from TS //Reset the userpage, to allow repushing from TS
IPC::userConnection userConn(pushLocation[it->first]); IPC::userConnection userConn(pushLocation[it->first]);
for (int i = 0; i < SIMUL_TRACKS; i++) { for (int i = 0; i < SIMUL_TRACKS; i++) {
@ -524,6 +527,7 @@ namespace Mist {
break; break;
} }
} }
}
pushLocation.erase(it->first); pushLocation.erase(it->first);
} }
nProxy.curPageNum.erase(it->first); nProxy.curPageNum.erase(it->first);