From b9fe3f3e47cd314337e34810dc097355ec486e67 Mon Sep 17 00:00:00 2001 From: Stephen Date: Thu, 3 Jan 2019 10:37:56 -0800 Subject: [PATCH] Cleaning up publishers on restore --- src/rqt_publisher/publisher.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rqt_publisher/publisher.py b/src/rqt_publisher/publisher.py index 1036dbb..f26ee61 100644 --- a/src/rqt_publisher/publisher.py +++ b/src/rqt_publisher/publisher.py @@ -388,6 +388,10 @@ def save_settings(self, plugin_settings, instance_settings): instance_settings.set_value('publishers', repr(publisher_copies)) def restore_settings(self, plugin_settings, instance_settings): + # If changing perspectives and rqt_publisher is already loaded, we need to clean up the + # previously existing publishers + self.clean_up_publishers() + publishers = eval(instance_settings.value('publishers', '[]')) for publisher in publishers: self._add_publisher(publisher)