Skip to content

Commit

Permalink
Use respondsToSelector instead of hasattr in _breakCycles.
Browse files Browse the repository at this point in the history
This addresses #145.

Closing the test window in the issue goes from taking 0.11 seconds to 0.01 seconds.
  • Loading branch information
typesupply committed Dec 20, 2023
1 parent 1862729 commit 9f22491
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Lib/vanilla/vanillaBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,9 +543,8 @@ def _breakCycles(view):
"""
Break cyclic references by deleting _target attributes.
"""
if hasattr(view, "vanillaWrapper"):
if view.respondsToSelector_("vanillaWrapper"):
obj = view.vanillaWrapper()
if hasattr(obj, "_breakCycles"):
obj._breakCycles()
obj._breakCycles()
for view in view.subviews():
_breakCycles(view)

0 comments on commit 9f22491

Please sign in to comment.