enthought / enthought/traitsui
wxAssertionError "GetEventHandler() == this" in individual tests
- Dominant language
- Python
- Stars
- 306
- Forks
- 99
- PR merge metrics
- No merged PRs in 30d
Description
The error is raised when trying to destroy children of `TraitsUIPanel` in custom `EnumEditor.rebuild_editor` and `CheckListEditor.rebuild_editor`. No error is raised if `DestroyChildren` is called when there are no children. Example traceback:
```
Traceback (most recent call last):
File "/Users/icernyte/.edm/envs/traitsui-test-3.6-wx/lib/python3.6/site-packages/traits/trait_notifiers.py", line 578, in _dispatch_change_event
self.dispatch(handler, *args)
File "/Users/icernyte/.edm/envs/traitsui-test-3.6-wx/lib/python3.6/site-packages/traits/trait_notifiers.py", line 682, in dispatch
handler(*args)
File "/Users/icernyte/Documents/repos/traitsui/traitsui/wx/enum_editor.py", line 130, in _values_changed
self.rebuild_editor()
File "/Users/icernyte/Documents/repos/traitsui/traitsui/wx/enum_editor.py", line 368, in rebuild_editor
panel.DestroyChildren()
wx._core.wxAssertionError: C++ assertion "GetEventHandler() == this" failed at /Users/robind/projects/bb2/dist-osx-py36/build/ext/wxWidgets/src/common/wincmn.cpp(475) in ~wxWindowBase(): any pushed event handlers must have b
een removed
```
It might be related that same error is raised in `DataFrameEditor` tests when attempting to destroy the `TraitsUIPanel` itself:
```
Traceback (most recent call last):
File "/Users/icernyte/Documents/repos/traitsui/traitsui/wx/toolkit.py", line 434, in destroy_control
control.Destroy()
File "/Users/icernyte/Documents/repos/traitsui/traitsui/wx/helper.py", line 358, in Destroy
super().Destroy()
wx._core.wxAssertionError: C++ assertion "GetEventHandler() == this" failed at /Users/robind/projects/bb2/dist-osx-py36/build/ext/wxWidgets/src/common/wincmn.cpp(475) in ~wxWindowBase(): any pushed event handlers must have b
een removed
```
There might be similar issues with other editors that use `TraitsUIPanel` but most of them don't have any tests or avoid the scenarios that cause issues (e.g. `SetEditor` doesn't call `DestroyChildren`)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.