Mac: fixed crash when discarding a signature (not moving enough) with self refenced links. Fixed link error with realsense2 library on Mac.

This commit is contained in:
matlabbe
2020-07-02 12:54:43 -04:00
parent cd10cafd0e
commit 33e9abdfad
3 changed files with 12 additions and 5 deletions

View File

@@ -293,6 +293,11 @@ IF(realsense2_FOUND)
${LIBRARIES}
${RealSense2_LIBRARIES}
)
ELSEIF(APPLE)
SET(LIBRARIES
${LIBRARIES}
${realsense2_LIBRARIES}
)
ELSE()
SET(LIBRARIES
${LIBRARIES}

View File

@@ -3475,11 +3475,13 @@ bool Rtabmap::process(
_optimizedPoses.erase(lastId);
for(std::multimap<int, Link>::iterator iter=_constraints.find(lastId); iter!=_constraints.end() && iter->first==lastId;++iter)
{
iter->second.to();
std::multimap<int, Link>::iterator jter = graph::findLink(_constraints, iter->second.to(), iter->second.from(), false);
if(jter != _constraints.end())
if(iter->second.to() != iter->second.from())
{
_constraints.erase(jter);
std::multimap<int, Link>::iterator jter = graph::findLink(_constraints, iter->second.to(), iter->second.from(), false);
if(jter != _constraints.end())
{
_constraints.erase(jter);
}
}
}
_constraints.erase(lastId);