Skip to content

Commit

Permalink
BUG: Safe hasattr for PyQt5 (#1161)
Browse files Browse the repository at this point in the history
* BUG: Safe hasattr for PyQt5

* Update pyface/ui/qt4/action/action_item.py

* MAINT: Timeout

Co-authored-by: Corran Webster <cwebster@enthought.com>
  • Loading branch information
larsoner and corranwebster authored Oct 12, 2022
1 parent 038d55d commit 608e153
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/test-with-edm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
toolkit: ['wx', 'pyqt5', 'pyside2', 'pyside6']
timeout-minutes: 20 # should be plenty, it's usually < 5
runs-on: ${{ matrix.os }}
env:
# Set root directory, mainly for Windows, so that the EDM Python
Expand Down
7 changes: 6 additions & 1 deletion pyface/ui/qt4/action/action_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,12 @@ def _qt4_on_destroyed(self, control=None):
"""
if self.control is not None:
# Remove the cycle since we're no longer needed.
if hasattr(self.control, "_tool_instance"):
try:
has_instance = hasattr(self.control, "_tool_instance")
# fixes mayavi #1180: PyQt5 "wrapped C/C++ object ... has been deleted"
except RuntimeError:
has_instance = False
if has_instance:
del self.control._tool_instance
self.control = None

Expand Down

0 comments on commit 608e153

Please sign in to comment.