Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expressly destroy a node's objects before the node. #456

Merged
merged 5 commits into from
Nov 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions rclpy/rclpy/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -1461,12 +1461,20 @@ def destroy_node(self) -> bool:
# It will be destroyed with other publishers below.
self._parameter_event_publisher = None

self.__publishers.clear()
self.__subscriptions.clear()
self.__clients.clear()
self.__services.clear()
self.__timers.clear()
self.__guards.clear()
# Destroy dependent items eagerly to work around a possible hang
# https://github.com/ros2/build_cop/issues/248
while self.__publishers:
self.destroy_publisher(self.__publishers[0])
while self.__subscriptions:
self.destroy_subscription(self.__subscriptions[0])
while self.__clients:
self.destroy_client(self.__clients[0])
while self.__services:
self.destroy_service(self.__services[0])
while self.__timers:
self.destroy_timer(self.__timers[0])
while self.__guards:
self.destroy_guard_condition(self.__guards[0])
self.handle.destroy()
self._wake_executor()

Expand Down