-
Notifications
You must be signed in to change notification settings - Fork 28
Use respondsToSelector instead of hasattr in _breakCycles. #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This addresses #145. Closing the test window in the issue goes from taking 0.11 seconds to 0.01 seconds.
@typemytype @justvanrossum Could one of you double check that I'm not making a mistake here. I'm 99% sure it is okay, but since this will affect every vanilla window ever, I'd like another pair of eyes on it. |
looks fine! the callback should only be used with nsObject (vanilla contentViews) approved +1 |
Lib/vanilla/vanillaBase.py
Outdated
obj = view.vanillaWrapper() | ||
if hasattr(obj, "_breakCycles"): | ||
obj._breakCycles() | ||
obj._breakCycles() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the vanillaWrapper object could be None, fe when weakref has no reference of that object anymore
testing if obj is not None:
will not slow down breakCycles
Update this branch.
Suggested by @typemytype in #200.
I don't know why any NSObject would be set as "vanillaWrapper" so remove this test.
@typemytype should this get merged? |
No. My solution doesn't work very well. It needs more thought. Thanks for checking though. |
This addresses #145.
Closing the test window in the issue goes from taking 0.11 seconds to 0.01 seconds.