enthought / pyface

pyface: traits-capable windowing framework
Other
105 stars 55 forks source link

Fix DirectoryDialog issue on manual close (vs. cancel) #1175

Closed corranwebster closed 1 year ago

corranwebster commented 1 year ago

This guards against the control having been deleted when we try to get the paths.

Fixes #1158.

nicolasap-dm commented 1 year ago

The DirectoryDialog fix works correctly.

The FileDialog fix is incomplete, since the close() method tries again to access attributes on the control a few lines down, resulting in

Traceback (most recent call last):
  File "mwe.py", line 4, in <module>
    outcome = dlg.open()
  File "/.../lib/python3.6/site-packages/pyface/i_dialog.py", line 168, in open
    self.close()
  File "/.../lib/python3.6/site-packages/pyface/ui/qt4/file_dialog.py", line 105, in close
    self.wildcard_index = self.control.nameFilters().index(
AttributeError: 'NoneType' object has no attribute 'nameFilters'
corranwebster commented 1 year ago

Thanks for the catch. That should now be resolved.