Skip to content

Commit

Permalink
Don't access deleted widget [#16668]
Browse files Browse the repository at this point in the history
  • Loading branch information
e-pettersen committed Jan 22, 2025
1 parent 8ec383d commit 3383dae
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/bundles/addh/src/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,17 @@ 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.")
self.delete()
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
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 3383dae

Please sign in to comment.