From 6a30e44756933031b7b39f8d410c234d00c8492a Mon Sep 17 00:00:00 2001 From: mr-alice Date: Tue, 30 Aug 2016 22:30:58 +0200 Subject: [PATCH] fixed bug in removal of directory --- .../src/file_sharing/directory_storage.cc | 26 ++++++++++++++++--- libretroshare/src/file_sharing/p3filelists.cc | 2 ++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/file_sharing/directory_storage.cc b/libretroshare/src/file_sharing/directory_storage.cc index 60662e701..518546c9d 100644 --- a/libretroshare/src/file_sharing/directory_storage.cc +++ b/libretroshare/src/file_sharing/directory_storage.cc @@ -141,7 +141,7 @@ public: return true; } - bool removeDirectory(const DirectoryStorage::EntryIndex& indx) + bool removeDirectory(DirectoryStorage::EntryIndex indx) // no reference here! Very important. Otherwise, the messign we do inside can change the value of indx!! { // check that it's a directory @@ -151,6 +151,10 @@ public: if(indx == 0) return nodeAccessError("checkIndex(): Cannot remove top level directory") ; +#ifdef DEBUG_DIRECTORY_STORAGE + std::cerr << "(--) Removing directory " << indx << std::endl; + print(); +#endif // remove from parent DirEntry& d(*static_cast(mNodes[indx])) ; @@ -158,8 +162,19 @@ public: for(uint32_t i=0;ientry_index << " because it does not exist." << std::endl; mRemoteDirectories[fi]->removeDirectory(item->entry_index); + + mRemoteDirectories[fi]->print(); } else if(item->flags & RsFileListsItem::FLAGS_ENTRY_UP_TO_DATE) {