-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Clean up QTimer/QSocketNotifier when exiting Qt event loop #790
base: main
Are you sure you want to change the base?
Conversation
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.
Thanks!
@ccordoba12, mind taking a look at this one as well? |
Thanks for the ping @blink1073! @stukowski, what do you mean by this?
I mean, what "an appropriate time" is? |
I meant: Do not delete the Note that there are probably more ways of cleaning these objects up. I was just proposing one possible solution, which seems sufficiently simple. Btw, I observed the problem of the timer and socket notifier not getting released by executing the second notebook cell below multiple times:
|
This is the thing that worries me a bit. I mean, what does this mean for an interactive Matplotlib figure generated with the PyQt5 backend? Closing the figure or simply stop interacting with it after some time? Pinging @tacaswell about this one too because he could be interested in knowing about it. |
No, the QTimer and the QSocketNotifier objects are just an internal implementation detail of the Let me describe the problem again for which I am proposing a solution: |
The
QTimer
andQSocketNotifier
helper objects, created by the_notify_stream_qt()
function as child objects of the globalQApplication
, need to be discarded after use when leaving the Qt event loop. Otherwise they keep piling up with each roundtrip between the Qt and the kernel event loop. This code change makes sure that these Qt objects destroy themselves at an appropriate time.