From 3383dae1e823df4fe4b0b0d1eeb9e520830375bc Mon Sep 17 00:00:00 2001 From: Eric Pettersen Date: Wed, 22 Jan 2025 11:08:15 -0800 Subject: [PATCH] Don't access deleted widget [#16668] --- src/bundles/addh/src/tool.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/bundles/addh/src/tool.py b/src/bundles/addh/src/tool.py index 345d833ad2..df736ed869 100644 --- a/src/bundles/addh/src/tool.py +++ b/src/bundles/addh/src/tool.py @@ -151,7 +151,9 @@ def add_h(self): from chimerax.core.errors import UserError self.tool_window.shown = False self.session.ui.processEvents() - if not self.structures: + # fetch not only for convenience, but so that we don't fetch from a deleted widget below [#16668] + my_structures = self.structures + if not my_structures: if self.process_info is None or self.process_info['structures'] is None: self.tool_window.shown = True raise UserError("No structures chosen for hydrogen addition.") @@ -159,7 +161,7 @@ def add_h(self): return settings = {} from chimerax.core.commands import run, concise_model_spec - cmd = "addh %s" % concise_model_spec(self.session, self.structures) + cmd = "addh %s" % concise_model_spec(self.session, my_structures) if not self.isolation.isChecked(): cmd += " inIsolation false" settings["in_isolation"] = False @@ -192,7 +194,7 @@ def add_h(self): args = [] kw = {} from chimerax.atomic import AtomicStructures - for name, value in [('structures', AtomicStructures(self.structures)), + for name, value in [('structures', AtomicStructures(my_structures)), ('tool_settings', settings)]: try: param = sig.parameters[name]