Skip to content

Commit fb78961

Browse files
committed
Refs #21183: Fix registration of two identical type supports
Signed-off-by: eduponz <eduardoponz@eprosima.com>
1 parent 6e47398 commit fb78961

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/cpp/fastdds/domain/DomainParticipantImpl.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,6 +1455,16 @@ ReturnCode_t DomainParticipantImpl::register_type(
14551455
return RETCODE_BAD_PARAMETER;
14561456
}
14571457

1458+
/*
1459+
* The type object registration sets the TypeIdentifiers in the type support's underlying TopicDataType.
1460+
* This means that that we need need to trigger the registration of the type object representation
1461+
* (idempotent operation) before finding the type in the registry.
1462+
* Otherwise, registering two TypeSupport instances with the same underlying TopicDataType will fail upon
1463+
* the second registration, as the TypeIdentifiers of the retrieved type from the registry would not be equal
1464+
* to those of the incoming type support.
1465+
*/
1466+
type.get()->register_type_object_representation();
1467+
14581468
TypeSupport t = find_type(type_name);
14591469

14601470
if (!t.empty())
@@ -1472,8 +1482,6 @@ ReturnCode_t DomainParticipantImpl::register_type(
14721482
std::lock_guard<std::mutex> lock(mtx_types_);
14731483
types_.insert(std::make_pair(type_name, type));
14741484

1475-
type.get()->register_type_object_representation();
1476-
14771485
return RETCODE_OK;
14781486
}
14791487

0 commit comments

Comments
 (0)