From fa3bb98baa2c1aa1aec55ab23f50bc31e9ae1b0f Mon Sep 17 00:00:00 2001 From: Will S Date: Tue, 23 Aug 2022 12:03:35 +0100 Subject: [PATCH] Revert "Don't rely on the _entities dictionary in the Entity finalizer." This reverts commit 54b90025c2f0c1b8d95a8acd10c9581f00b5aa3e. --- cyclonedds/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cyclonedds/core.py b/cyclonedds/core.py index f3f506f4..a13e3c10 100644 --- a/cyclonedds/core.py +++ b/cyclonedds/core.py @@ -187,10 +187,10 @@ def __init__(self, ref: int, listener: "Listener" = None) -> None: self._listener = listener def __del__(self) -> None: - if not hasattr(self, "_ref"): + if not hasattr(self, "_ref") or self._ref not in self._entities: return - self._entities.pop(self._ref, None) + del self._entities[self._ref] self._delete(self._ref) def get_subscriber(self) -> Optional["cyclonedds.sub.Subscriber"]: