Skip to content

Commit

Permalink
Fix Gazebo crash in building editor when adding door or window (gazeb…
Browse files Browse the repository at this point in the history
…osim#2276)

BuildingMaker::DetachFromParent: break loop after DetachAllChildren.
Prevents memory corruption by iterating over attachmentMap while removing elements.
  • Loading branch information
jensanjo committed Nov 7, 2021
1 parent 01b395a commit 05cd8e1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gazebo/gui/building/BuildingMaker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,10 @@ void BuildingMaker::DetachFromParent(const std::string &_child)
parentManip.second.erase(std::remove(parentManip.second.begin(),
parentManip.second.end(), _child), parentManip.second.end());

if (parentManip.second.empty())
if (parentManip.second.empty()) {
this->DetachAllChildren(parentManip.first);
break;
}
}
}

Expand Down

0 comments on commit 05cd8e1

Please sign in to comment.