fixed bug introduced in 6910, due to calling member on deleted mCreator

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6914 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2013-11-28 19:43:14 +00:00
parent dda9d4eca5
commit 01588f6f53
2 changed files with 21 additions and 6 deletions

View File

@ -1685,7 +1685,6 @@ bool ftController::FileDetails(const std::string &hash, FileInfo &info)
/* extract details */ /* extract details */
info.hash = hash; info.hash = hash;
info.fname = it->second->mName; info.fname = it->second->mName;
info.lastTS = it->second->mCreator->lastRecvTimeStamp();
info.storage_permission_flags.clear() ; info.storage_permission_flags.clear() ;
info.transfer_info_flags = it->second->mFlags ; info.transfer_info_flags = it->second->mFlags ;
info.priority = SPEED_NORMAL ; info.priority = SPEED_NORMAL ;
@ -1703,7 +1702,10 @@ bool ftController::FileDetails(const std::string &hash, FileInfo &info)
{ {
it->second->mTransfer->getFileSources(peerIds); it->second->mTransfer->getFileSources(peerIds);
info.priority = it->second->mTransfer->downloadPriority() ; info.priority = it->second->mTransfer->downloadPriority() ;
info.lastTS = it->second->mCreator->lastRecvTimeStamp();
} }
else
info.lastTS = 0;
double totalRate = 0; double totalRate = 0;
uint32_t tfRate = 0; uint32_t tfRate = 0;

View File

@ -937,12 +937,25 @@ int TransfersDialog::addItem(int row, const FileInfo &fileInfo, const std::map<s
qlonglong completed = fileInfo.transfered; qlonglong completed = fileInfo.transfered;
qlonglong remaining = fileInfo.size - fileInfo.transfered; qlonglong remaining = fileInfo.size - fileInfo.transfered;
qlonglong downloadtime = (fileInfo.size - fileInfo.transfered) / (fileInfo.tfRate * 1024.0); qlonglong downloadtime = (fileInfo.size - fileInfo.transfered) / (fileInfo.tfRate * 1024.0);
qint64 qi64LastDL = fileInfo.lastTS ; //std::numeric_limits<qint64>::max(); qint64 qi64LastDL = fileInfo.lastTS ; //std::numeric_limits<qint64>::max();
QString strPath = QString::fromUtf8(fileInfo.path.c_str()); if (qi64LastDL == 0) // file is complete, or any raison why the time has not been set properly
QString strPathAfterDL = strPath; {
strPathAfterDL.replace(QString::fromUtf8(rsFiles->getDownloadDirectory().c_str()),""); QFileInfo file;
QStringList qslPath = strPathAfterDL.split("/");
if (fileInfo.downloadStatus == FT_STATE_COMPLETE)
file = QFileInfo(QString::fromUtf8(fileInfo.path.c_str()), QString::fromUtf8(fileInfo.fname.c_str()));
else
file = QFileInfo(QString::fromUtf8(rsFiles->getPartialsDirectory().c_str()), QString::fromUtf8(fileInfo.hash.c_str()));
/*Get Last Access on File */
if (file.exists())
qi64LastDL = file.lastModified().toTime_t();
}
QString strPath = QString::fromUtf8(fileInfo.path.c_str());
QString strPathAfterDL = strPath;
strPathAfterDL.replace(QString::fromUtf8(rsFiles->getDownloadDirectory().c_str()),"");
QStringList qslPath = strPathAfterDL.split("/");
FileChunksInfo fcinfo; FileChunksInfo fcinfo;
if (!rsFiles->FileDownloadChunksDetails(fileInfo.hash, fcinfo)) { if (!rsFiles->FileDownloadChunksDetails(fileInfo.hash, fcinfo)) {