[PyQt] Segfault with 5.9 snapshot when connecting to destroyed signal

Florian Bruhin me at the-compiler.org
Tue Jun 6 16:20:49 BST 2017

On Tue, Jun 06, 2017 at 03:34:12PM +0100, Phil Thompson wrote:
> On 5 Jun 2017, at 10:42 pm, Florian Bruhin <me at the-compiler.org> wrote:
> > 
> > Hi,
> > 
> > the attached script works fine with PyQt 5.8, but segfaults with the
> > current 5.9 snapshot. This is a simplified version of pytest-qt's
> > SignalBlocker: http://pytest-qt.readthedocs.io/en/latest/signals.html
> > 
> > The "self.args = args" saves a reference to the to-be-destroyed object,
> > which probably triggers this in some way - saving the arguments is done
> > as a general thing here though. It's probably a bit unorthodox, but
> > still shouldn't segfault I guess?
> Should be fixed in tonight's PyQt snapshot.
> Current snapshots have additional code to detect when certain objects
> get destroyed. This is deceptively difficult to get right (as you have
> found). I'd appreciate any testing you can do with the snapshots
> before the v5.9 release.

Thanks! Another thing I've noticed is with code like this:

    class NetworkManager(QNetworkAccessManager):
        def __init__(self, parent=None):
            self._replies = []
        def createRequest(self, *args):
            reply = super().createRequest(*args)
            return reply

I suddenly got "ValueError: list.remove(x): x not in list" with the
snapshot which I didn't with 5.8.

I ended up just removing[1] that reply tracking because I didn't need it
anymore, but now I wonder whether that's expected. I'm guessing the
argument of the destroyed signal doesn't compare equal to what I
stored earlier anymore?

Let me know if you need a minimal example and I'll see if I can write one.

Other than that, my (pretty big) testsuite for qutebrowser[2] passed

[1] https://github.com/qutebrowser/qutebrowser/commit/a45de9cef2f8c292d42aa4f63bf6a1ea08557508
[2] https://qutebrowser.org/


https://www.qutebrowser.org  | me at the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072  | https://the-compiler.org/pubkey.asc
         I love long mails!  | https://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170606/cb31f1a8/attachment.sig>

More information about the PyQt mailing list