- bugfix for mod menu segfault when user clicks like mad

This commit is contained in:
Mark Vejvoda 2011-04-20 05:04:43 +00:00
parent 6967f23a92
commit 98a3c5e699
1 changed files with 14 additions and 1 deletions

View File

@ -1662,9 +1662,22 @@ void MenuStateMods::showDesription(const ModInfo *modInfo) {
string tempImage = getPreviewImageFileForMod(modInfo);
if(tempImage != "" && fileExists(tempImage) == false) {
if(ftpClientThread != NULL) ftpClientThread->addFileToRequests(tempImage,modInfo->imageUrl);
static string mutexOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__);
MutexSafeWrapper safeMutexFTPProgress((ftpClientThread != NULL ? ftpClientThread->getProgressMutex() : NULL),mutexOwnerId);
if(ftpClientThread != NULL && ftpClientThread->getProgressMutex() != NULL) ftpClientThread->getProgressMutex()->setOwnerId(mutexOwnerId);
fileFTPProgressList[tempImage] = pair<int,string>(0,"");
safeMutexFTPProgress.ReleaseLock();
}
else {
displayModPreviewImage = true;
static string mutexOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__);
MutexSafeWrapper safeMutexFTPProgress((ftpClientThread != NULL ? ftpClientThread->getProgressMutex() : NULL),mutexOwnerId);
if(ftpClientThread != NULL && ftpClientThread->getProgressMutex() != NULL) ftpClientThread->getProgressMutex()->setOwnerId(mutexOwnerId);
if(fileFTPProgressList.find(tempImage) == fileFTPProgressList.end()) {
displayModPreviewImage = true;
}
safeMutexFTPProgress.ReleaseLock();
}
}
}