Skip to content

Commit

Permalink
delete associated dds_entity in DDScObjectDelegate.close (#505)
Browse files Browse the repository at this point in the history
* delete associated dds_entity in DDScObjectDelegate.close

Signed-off-by: Marcel Jordense <[email protected]>

* close ObjectDelegate in destructor when it was not yet closed

Signed-off-by: Marcel Jordense <[email protected]>

---------

Signed-off-by: Marcel Jordense <[email protected]>
  • Loading branch information
MarcelJordense authored Aug 21, 2024
1 parent 86eda0c commit 14f510d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/ddscxx/src/org/eclipse/cyclonedds/core/DDScObjectDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,25 @@ org::eclipse::cyclonedds::core::DDScObjectDelegate::DDScObjectDelegate () :

org::eclipse::cyclonedds::core::DDScObjectDelegate::~DDScObjectDelegate ()
{
delete_from_entity_map();
if (!this->closed) {
try {
this->close();
} catch (...) {

if (this->ddsc_entity > 0) {
dds_delete(this->ddsc_entity);
this->ddsc_entity = 0;
}
}
}

void
org::eclipse::cyclonedds::core::DDScObjectDelegate::close ()
{
delete_from_entity_map();

if (this->ddsc_entity > 0) {
dds_delete(this->ddsc_entity);
this->ddsc_entity = 0;
}

org::eclipse::cyclonedds::core::ObjectDelegate::close();
}

Expand Down

0 comments on commit 14f510d

Please sign in to comment.