mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-11 15:39:36 -05:00
Corrected two nasty bugs in file transfer which caused random core dumps (at least on ubuntu 32 and 64 bits)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@957 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c43b3ae617
commit
3012683143
@ -215,9 +215,16 @@ bool ftController::completeFile(std::string hash)
|
|||||||
|
|
||||||
ftFileControl *fc = &(it->second);
|
ftFileControl *fc = &(it->second);
|
||||||
|
|
||||||
|
// (csoler) I've postponed this to the end of the block because deleting the
|
||||||
|
// element from the map calls the destructor of fc->mTransfer, which
|
||||||
|
// makes fc to point to nothing and causes random behavior/crashes.
|
||||||
|
//
|
||||||
|
// mDataplex->removeTransferModule(fc->mTransfer->hash());
|
||||||
|
//
|
||||||
/* done - cleanup */
|
/* done - cleanup */
|
||||||
|
|
||||||
mDataplex->removeTransferModule(fc->mTransfer->hash());
|
// (csoler) I'm copying this because "delete fc->mTransfer" deletes the hash string!
|
||||||
|
std::string hash_to_suppress(fc->mTransfer->hash());
|
||||||
|
|
||||||
if (fc->mTransfer)
|
if (fc->mTransfer)
|
||||||
{
|
{
|
||||||
@ -274,6 +281,7 @@ bool ftController::completeFile(std::string hash)
|
|||||||
doCallback = fc->mDoCallback;
|
doCallback = fc->mDoCallback;
|
||||||
callbackCode = fc->mCallbackCode;
|
callbackCode = fc->mCallbackCode;
|
||||||
|
|
||||||
|
mDataplex->removeTransferModule(hash_to_suppress) ;
|
||||||
mDownloads.erase(it);
|
mDownloads.erase(it);
|
||||||
} /******* UNLOCKED ********/
|
} /******* UNLOCKED ********/
|
||||||
|
|
||||||
|
@ -204,8 +204,8 @@ void ftServer::run()
|
|||||||
for (it = toDels.begin();it != toDels.end(); it++)
|
for (it = toDels.begin();it != toDels.end(); it++)
|
||||||
{
|
{
|
||||||
sit = mFtDataplex->mServers.find(*it);
|
sit = mFtDataplex->mServers.find(*it);
|
||||||
mFtDataplex->mServers.erase(sit);
|
|
||||||
delete sit->second;
|
delete sit->second;
|
||||||
|
mFtDataplex->mServers.erase(sit);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
Loading…
Reference in New Issue
Block a user