Skip to content

Commit

Permalink
Avoid crash when file transfer can't open files
Browse files Browse the repository at this point in the history
916e43b inadvertently adds a failed File Transfer to the fileTransferList
causing a segfault when a subsequent socket disconnection attempts to clean up and
delete the File Transfer again.

Fixes #12650
  • Loading branch information
dizygotheca committed Apr 11, 2016
1 parent 6a7592a commit ea5fdd4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions mythtv/programs/mythbackend/mainserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1941,15 +1941,13 @@ void MainServer::HandleAnnounce(QStringList &slist, QStringList commands,
if (!controlSocketList.remove(socket))
return; // socket was disconnected
ft = new FileTransfer(filename, socket, writemode);
fileTransferList.push_back(ft);
}
else
{
QWriteLocker lock(&sockListLock);
if (!controlSocketList.remove(socket))
return; // socket was disconnected
ft = new FileTransfer(filename, socket, usereadahead, timeout_ms);
fileTransferList.push_back(ft);
}

if (!ft->isOpen())
Expand All @@ -1963,6 +1961,7 @@ void MainServer::HandleAnnounce(QStringList &slist, QStringList commands,
return;
}
ft->IncrRef();
fileTransferList.push_back(ft);

retlist << QString::number(socket->GetSocketDescriptor());
retlist << QString::number(ft->GetFileSize());
Expand Down

0 comments on commit ea5fdd4

Please sign in to comment.