@@ -146,6 +146,7 @@ def __init__(self, context):
146146 def shutdown_plugin (self ):
147147 self ._update_cm_list_timer .stop ()
148148 self ._update_ctrl_list_timer .stop ()
149+ self ._update_hw_components_list_timer .stop ()
149150 self ._popup_widget .hide ()
150151
151152 def save_settings (self , plugin_settings , instance_settings ):
@@ -164,7 +165,13 @@ def restore_settings(self, plugin_settings, instance_settings):
164165 pass
165166
166167 def _update_cm_list (self ):
167- update_combo (self ._widget .cm_combo , _list_controller_managers (self ._node ))
168+ try :
169+ update_combo (self ._widget .cm_combo , _list_controller_managers (self ._node ))
170+ except Exception as e :
171+ if "destruction was requested" in str (e ) or "context is not valid" in str (e ):
172+ self ._update_cm_list_timer .stop ()
173+ return
174+ raise
168175
169176 def _on_cm_change (self , cm_name ):
170177 self ._cm_name = cm_name
@@ -178,7 +185,13 @@ def _update_controllers(self):
178185 return
179186
180187 # Find controllers associated to the selected controller manager
181- controllers = self ._list_controllers ()
188+ try :
189+ controllers = self ._list_controllers ()
190+ except Exception as e :
191+ if "destruction was requested" in str (e ) or "context is not valid" in str (e ):
192+ self ._update_ctrl_list_timer .stop ()
193+ return
194+ raise
182195
183196 # Update controller display, if necessary
184197 if self ._controllers != controllers :
@@ -321,7 +334,13 @@ def _update_hw_components(self):
321334 return
322335
323336 # Find hw_components associated to the selected controller manager
324- hw_components = self ._list_hw_components ()
337+ try :
338+ hw_components = self ._list_hw_components ()
339+ except Exception as e :
340+ if "destruction was requested" in str (e ) or "context is not valid" in str (e ):
341+ self ._update_hw_components_list_timer .stop ()
342+ return
343+ raise
325344
326345 # Update controller display, if necessary
327346 if self ._hw_components != hw_components :
@@ -635,11 +654,16 @@ def _list_controller_managers(node):
635654 @return List of controller manager node names
636655 @rtype list of str
637656 """
638- return [
639- name .rstrip ("list_controllers" ).rstrip ("/" )
640- for name , _ in get_service_names_and_types (node = node )
641- if name .endswith ("list_controllers" )
642- ]
657+ try :
658+ return [
659+ name .rstrip ("list_controllers" ).rstrip ("/" )
660+ for name , _ in get_service_names_and_types (node = node )
661+ if name .endswith ("list_controllers" )
662+ ]
663+ except Exception as e :
664+ if "destruction was requested" in str (e ) or "context is not valid" in str (e ):
665+ return []
666+ raise
643667
644668
645669def _get_parameter_controller_names (node , node_name ):
0 commit comments