diff --git a/source/RobotAPI/components/armem/server/ObjectMemory/ObjectMemory.cpp b/source/RobotAPI/components/armem/server/ObjectMemory/ObjectMemory.cpp index 8eed518e42f0aea83de3606aaf36b83081c980e1..0c5d82c8da19676c0ab3b544ea381ed7ae5f8776 100644 --- a/source/RobotAPI/components/armem/server/ObjectMemory/ObjectMemory.cpp +++ b/source/RobotAPI/components/armem/server/ObjectMemory/ObjectMemory.cpp @@ -86,8 +86,6 @@ namespace armarx::armem::server::obj { workingMemory.name() = defaultMemoryName; - instance::SegmentAdapter::init(); - const auto initSegmentWithCatch = [&](const std::string & segmentName, const auto&& fn) { try @@ -108,11 +106,15 @@ namespace armarx::armem::server::obj } }; + // Class segment needs to be initialized before instance segment, + // as the instance segment may refer to and search through the class segment. initSegmentWithCatch("class", [&]() { classSegment.init(); }); + instance::SegmentAdapter::init(); + initSegmentWithCatch("articulated object class", [&]() { articulatedObjectClassSegment.init(); @@ -206,7 +208,6 @@ namespace armarx::armem::server::obj void ObjectMemory::RemoteGui_update() { - // Non-atomic variables need to be guarded by a mutex if accessed by multiple threads tab->instance.update(*this); tab->clazz.update(classSegment);