From 4f44922f4287101c0d9528c8f4766e998b4b0192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Bueno=20L=C3=B3pez?= <69244257+JLBuenoLopez-eProsima@users.noreply.github.com> Date: Wed, 24 Apr 2024 07:20:01 +0200 Subject: [PATCH] Structure DynamicType inheritance from TypeObject (#4712) * Hotfix: Struct DynamicType inheritance from TypeObject Signed-off-by: JLBuenoLopez-eProsima * Apply review suggestion Signed-off-by: JLBuenoLopez-eProsima --------- Signed-off-by: JLBuenoLopez-eProsima --- .../dynamic_types/DynamicTypeBuilderFactoryImpl.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/cpp/fastdds/xtypes/dynamic_types/DynamicTypeBuilderFactoryImpl.cpp b/src/cpp/fastdds/xtypes/dynamic_types/DynamicTypeBuilderFactoryImpl.cpp index 2b1df2c7076..94e7af98ee9 100644 --- a/src/cpp/fastdds/xtypes/dynamic_types/DynamicTypeBuilderFactoryImpl.cpp +++ b/src/cpp/fastdds/xtypes/dynamic_types/DynamicTypeBuilderFactoryImpl.cpp @@ -607,22 +607,24 @@ traits::ref_type DynamicTypeBuilderFactoryImpl::create_struc type_descriptor.extensibility_kind(struct_type.struct_flags() & xtypes::IS_FINAL ? ExtensibilityKind::FINAL : (struct_type.struct_flags() & xtypes::IS_MUTABLE ? ExtensibilityKind::MUTABLE : ExtensibilityKind::APPENDABLE)); - - ret_val = std::make_shared(type_descriptor); - + bool inheritance_correct {true}; if (xtypes::TK_NONE != struct_type.header().base_type()._d()) { traits::ref_type base_type = base_type_from_type_identifier(struct_type.header().base_type()); if (base_type) { - ret_val->get_descriptor().base_type(base_type); + type_descriptor.base_type(base_type); } else { EPROSIMA_LOG_ERROR(DYN_TYPES, "Inconsistent base TypeIdentifier"); - ret_val.reset(); + inheritance_correct = false; } } + if (inheritance_correct) + { + ret_val = std::make_shared(type_descriptor); + } if (ret_val) {