File tree 1 file changed +5
-0
lines changed
include/ignition/gazebo/detail
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 20
20
#include < cstring>
21
21
#include < map>
22
22
#include < memory>
23
+ #include < mutex>
23
24
#include < optional>
24
25
#include < set>
25
26
#include < tuple>
@@ -486,6 +487,9 @@ void EntityComponentManager::EachRemoved(typename identity<std::function<
486
487
template <typename ...ComponentTypeTs>
487
488
detail::View<ComponentTypeTs...> *EntityComponentManager::FindView () const
488
489
{
490
+ static std::mutex mutex;
491
+ std::lock_guard<std::mutex> lock (mutex);
492
+
489
493
auto viewKey = std::vector<ComponentTypeId>{ComponentTypeTs::typeId...};
490
494
491
495
auto baseViewPtr = this ->FindView (viewKey);
@@ -494,6 +498,7 @@ detail::View<ComponentTypeTs...> *EntityComponentManager::FindView() const
494
498
auto view = static_cast <detail::View<ComponentTypeTs...>*>(baseViewPtr);
495
499
496
500
// add any new entities to the view before using it
501
+ view->ToAddEntities ();
497
502
for (const auto &[entity, isNew] : view->ToAddEntities ())
498
503
{
499
504
view->AddEntityWithConstComps (entity, isNew,
You can’t perform that action at this time.
0 commit comments