Skip to content

Commit

Permalink
Don't iterate over a collection being modified.
Browse files Browse the repository at this point in the history
Signed-off-by: Steven! Ragnarök <[email protected]>
  • Loading branch information
nuclearsandwich committed Nov 8, 2019
1 parent 30600a1 commit 0337867
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions rclpy/rclpy/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -1461,18 +1461,18 @@ def destroy_node(self) -> bool:
# It will be destroyed with other publishers below.
self._parameter_event_publisher = None

for p in self.__publishers:
self.destroy_publisher(p)
for s in self.__subscriptions:
self.destroy_subscriber(s)
for c in self.__clients:
self.destroy_client(c)
for s in self.__services:
self.destroy_service(s)
for t in self.__timers:
self.destroy_timer(t)
for g in self.__guards:
self.destroy_guard(g)
while self.__publishers:
self.destroy_publisher(self.__publishers.pop())
while self.__subscriptions:
self.destroy_subscriber(self.__subscriptions.pop())
while self.__clients:
self.destroy_client(self.__clients.pop())
while self.__services:
self.destroy_service(self.__services.pop())
while self.__timers:
self.destroy_timer(self.__timers.pop())
while self.__guards:
self.destroy_guard(self.__guards.pop())
self.handle.destroy()
self._wake_executor()

Expand Down

0 comments on commit 0337867

Please sign in to comment.