Bug report: Exception when closing a workbench with status bar
- Dominant language
- Python
- Stars
- 115
- Forks
- 54
- PR merge metrics
- No merged PRs in 30d
Description
## Environment
OS: _Windows_
Python version: _3.10_
Toolkit: _Wx_
## Description
When creating a `Workbench` with a `status_bar`, the following exception is raised when closing the window:
```
Traceback (most recent call last):
File "D:\ANSYSDev\thirdparty_sources\pyface\pyface\dock\dock_sizer.py", line 4022, in CalcMin
dx, dy = self._contents.calc_min()
File "D:\ANSYSDev\thirdparty_sources\pyface\pyface\dock\dock_sizer.py", line 3190, in calc_min
dx, dy = item.calc_min(use_size)
File "D:\ANSYSDev\thirdparty_sources\pyface\pyface\dock\dock_sizer.py", line 2402, in calc_min
theme = self.theme
File "D:\ANSYSDev\thirdparty_sources\pyface\pyface\dock\dock_sizer.py", line 503, in _get_theme
return self.control.GetParent().owner.theme
RuntimeError: wrapped C/C++ object of type TraitsUIPanel has been deleted
```
## Steps to Reproduce
- Run the following script (adapted and minimized from the `workbench` example):
```python
from traits.etsconfig.api import ETSConfig
ETSConfig.toolkit = 'wx'
from traits.api import HasTraits, Int, Str
from pyface.api import GUI
from pyface.action.api import StatusBarManager
from pyface.workbench.api import WorkbenchWindow, Workbench
class ExampleWorkbenchWindow(WorkbenchWindow):
def _status_bar_manager_default(self):
return StatusBarManager(messages=['', ''])
class Person(HasTraits):
name = Str()
age = Int()
def __str__(self):
return self.name
if __name__ == "__main__":
gui = GUI()
fred = Person(name="fred", age=42)
workbench = Workbench(state_location=gui.state_location, window_factory=ExampleWorkbenchWindow)
window = workbench.create_window()
window.open()
window.edit(fred)
gui.start_event_loop()
```
- Close the application
## Other observations
The exception does _not_ occur if the window tab (`fred`) is closed before closing the Application.
Changing the toolkit to `'qt'` also makes the exception disappear.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.