-
Notifications
You must be signed in to change notification settings - Fork 26
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
FIX: atexit hook to clean up cache threads, TyphosSuite garbage collection #516
Conversation
This works for me inside a docker container that reproduces travis testing conditions, removing the QThread teardown failures at the end of the pytest suite. Other test suite bugs are still in travis however |
da804b0
to
9be6a37
Compare
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.
I think I need to do my homework and finally read up on how all the weakref mechanisms work
All of this looks good to me
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.
This looks good to me. The test suite passes on Travis, so I'd say the proof is in the pudding.
This left me wondering what other apps might benefit from garbage collection utilities like this. I suppose we won't really know until we hit upon more problems, but if it's been solved once it can be solved again!
typhos/suite.py
Outdated
QtCore.Qt.QueuedConnection) | ||
parameter.sigHide.connect(partial(self.hide_subdisplay, parameter), | ||
QtCore.Qt.QueuedConnection) | ||
self._connect_partial( |
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.
To make sure I have this straight, TyphosBase._connect_partial
connects a WeakPartialMethodSlot
to a signal.
- Should we name
_connect_partial
->_weak_connect_partial
or something that makes it obvious that weak refs are being used? I can see myself forgetting that and thinking_connect_partial
is just a wrapper aroundfunctools.partial
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.
Tweaked the name - going to merge and re-run CI on another long-open PR
Description
functools.partial
usage in methods as this was causing TyphosSuite from getting garbage collectedMotivation and Context
QApplication.aboutToQuit
instead ofatexit
, thinking it'd be better to clean up when the QApplication does. I found that the slot wasn't getting called and fell back toatexit
.test_benchmark
are configured to run and create very nested device displays. These device displays were supposed to get garbage collected between tests, but they were not.test_cli
, typhos instructed Qt to reload stylesheets for every widget in the application.How Has This Been Tested?
Where Has This Been Documented?
PRs and issues