@@ -147,6 +147,7 @@ def __init__(self, context):
147147 def shutdown_plugin (self ):
148148 self ._update_cm_list_timer .stop ()
149149 self ._update_ctrl_list_timer .stop ()
150+ self ._update_hw_components_list_timer .stop ()
150151 self ._popup_widget .hide ()
151152
152153 def save_settings (self , plugin_settings , instance_settings ):
@@ -165,7 +166,13 @@ def restore_settings(self, plugin_settings, instance_settings):
165166 pass
166167
167168 def _update_cm_list (self ):
168- update_combo (self ._widget .cm_combo , _list_controller_managers (self ._node ))
169+ try :
170+ update_combo (self ._widget .cm_combo , _list_controller_managers (self ._node ))
171+ except Exception as e :
172+ if "destruction was requested" in str (e ) or "context is not valid" in str (e ):
173+ self ._update_cm_list_timer .stop ()
174+ return
175+ raise
169176
170177 def _on_cm_change (self , cm_name ):
171178 self ._cm_name = cm_name
@@ -179,7 +186,13 @@ def _update_controllers(self):
179186 return
180187
181188 # Find controllers associated to the selected controller manager
182- controllers = self ._list_controllers ()
189+ try :
190+ controllers = self ._list_controllers ()
191+ except Exception as e :
192+ if "destruction was requested" in str (e ) or "context is not valid" in str (e ):
193+ self ._update_ctrl_list_timer .stop ()
194+ return
195+ raise
183196
184197 # Update controller display, if necessary
185198 if self ._controllers != controllers :
@@ -322,7 +335,13 @@ def _update_hw_components(self):
322335 return
323336
324337 # Find hw_components associated to the selected controller manager
325- hw_components = self ._list_hw_components ()
338+ try :
339+ hw_components = self ._list_hw_components ()
340+ except Exception as e :
341+ if "destruction was requested" in str (e ) or "context is not valid" in str (e ):
342+ self ._update_hw_components_list_timer .stop ()
343+ return
344+ raise
326345
327346 # Update controller display, if necessary
328347 if self ._hw_components != hw_components :
@@ -644,11 +663,16 @@ def _list_controller_managers(node):
644663 @return List of controller manager node names
645664 @rtype list of str
646665 """
647- return [
648- name .rstrip ("list_controllers" ).rstrip ("/" )
649- for name , _ in get_service_names_and_types (node = node )
650- if name .endswith ("list_controllers" )
651- ]
666+ try :
667+ return [
668+ name .rstrip ("list_controllers" ).rstrip ("/" )
669+ for name , _ in get_service_names_and_types (node = node )
670+ if name .endswith ("list_controllers" )
671+ ]
672+ except Exception as e :
673+ if "destruction was requested" in str (e ) or "context is not valid" in str (e ):
674+ return []
675+ raise
652676
653677
654678def _get_parameter_controller_names (node , node_name ):
0 commit comments