-
-
Notifications
You must be signed in to change notification settings - Fork 69
Disconnect SignalBlocker after exiting loop. #71
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
Conversation
Otherwise, a second signal emission will still call the functions of the already garbage-collected SignalBlocker with PyQt5 < 5.3. The signals could already be disconnected, so the TypeError (older PyQt versions) or RuntimeError (newer PyQt versions) which is raised in that case is ignored. Fixes #69.
self._loop.exec_() | ||
if not self.signal_triggered and self.raising: | ||
raise SignalTimeoutError("Didn't get signal after %sms." % | ||
self.timeout) | ||
|
||
def _quit_loop_by_timeout(self): | ||
self._loop.quit() | ||
self._cleanup() |
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.
Shouldn't cleanup always be called? If so, I think you should call it as soon after self._loop.exec_()
finishes (in line 377).
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.
True - I first only had it in _quit_loop_by_signal
and then noticed it's also needed on timeouts, that's why I didn't think of putting it there.
@The-Compiler, could you also add a new |
Gah... the newest commit (a4ca81a) breaks it again:
I'll investigate what's happening later. |
Okay... I have no idea what difference the commit would make... Do you? |
Hmmm if I have to guess as I can't debug this right now, I think during It's really a disappointment that signal disconnection is not handled automatically... I believe it was handled automatically in other PyQt versions (at least PyQt4). Btw sorry if I don't answer all issues/PRs Today because I'm kinda busy, but I will probably be able to work on them tomorrow. 😄 |
The issue does (for a reason I don't know) not happen with MultiSignalBlocker in the first place, so I didn't want to needlessly complicate that. However, the SingleSignalBlocker test fails after changing where
Yeah, as said it's also handled properly in PyQt5 5.3 and newer, this is really only an issue with ancient PyQt versions (but Ubuntu Trusty, which is still supported until 2019, comes with 5.2).
No worries - take your time! I just did a brain-dump of everything still in my mind 😉 |
Yes, we can improve that later.
More than welcome to do that! 😄 |
This reverts commit a4ca81a. For some reason this makes the test fail on Trusty again, and nobody seems to understand why - so let's just keep the old way.
I reverted the commit and made sure the test passes on Trusty (after struggling with the VM a bit). This is good to merge from my POV now. |
Disconnect SignalBlocker after exiting loop.
Otherwise, a second signal emission will still call the functions of the
already garbage-collected SignalBlocker with PyQt5 < 5.3.
The signals could already be disconnected, so the TypeError (older PyQt
versions) or RuntimeError (newer PyQt versions) which is raised in that case is
ignored.
Fixes #69.