From e415dd8504cb48f4085fb23ff4e8d75161cb5022 Mon Sep 17 00:00:00 2001 From: matlabbe Date: Tue, 4 Apr 2017 12:26:06 -0400 Subject: [PATCH] Fixed inf loop when all signatures are loaded in WM and if a signature has a -1 word --- corelib/src/Memory.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/corelib/src/Memory.cpp b/corelib/src/Memory.cpp index c1ef15c955..78c12c431d 100644 --- a/corelib/src/Memory.cpp +++ b/corelib/src/Memory.cpp @@ -239,8 +239,10 @@ void Memory::loadDataFromDb(bool postInitClosingEvents) // Now load the dictionary if we have a connection if(postInitClosingEvents) UEventsManager::post(new RtabmapEventInit("Loading dictionary...")); + UDEBUG("Loading dictionary..."); if(loadAllNodesInWM) { + UDEBUG("load all referenced words in working memory"); // load all referenced words in working memory std::set wordIds; const std::map & signatures = this->getSignatures(); @@ -248,7 +250,7 @@ void Memory::loadDataFromDb(bool postInitClosingEvents) { const std::multimap & words = i->second->getWords(); std::list keys = uUniqueKeys(words); - for(std::list::iterator iter=keys.begin(); iter!=keys.end();) + for(std::list::iterator iter=keys.begin(); iter!=keys.end(); ++iter) { if(*iter > 0) { @@ -256,6 +258,8 @@ void Memory::loadDataFromDb(bool postInitClosingEvents) } } } + + UDEBUG("load words %d", (int)wordIds.size()); if(wordIds.size()) { std::list words; @@ -272,6 +276,7 @@ void Memory::loadDataFromDb(bool postInitClosingEvents) } else { + UDEBUG("load words"); // load the last dictionary _dbDriver->load(_vwd); }