fixed some mutex bugs and some pointer access bugs in the FileIndexStore

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1525 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2009-08-12 22:06:11 +00:00
parent caf1c7850f
commit 243af3ffee
3 changed files with 40 additions and 16 deletions

View file

@ -166,8 +166,6 @@ int FileIndexStore::RequestDirDetails(std::string uid, std::string path, DirDeta
int FileIndexStore::RequestDirDetails(void *ref, DirDetails &details, uint32_t flags) const
{
lockData();
#ifdef FIS_DEBUG
std::cerr << "FileIndexStore::RequestDirDetails() ref=" << ref << " flags: " << flags << std::endl;
#endif
@ -175,6 +173,14 @@ int FileIndexStore::RequestDirDetails(void *ref, DirDetails &details, uint32_t f
bool found = true;
std::map<RsPeerId, FileIndex *>::const_iterator pit;
lockData();
if(ref != NULL && !FileIndex::isValid(ref))
{
unlockData() ;
return false ;
}
/* so cast *ref to a DirEntry */
FileEntry *file = (FileEntry *) ref;
DirEntry *dir = dynamic_cast<DirEntry *>(file);