[PyQt] Getting a segfault when I close my program

Darryl Wallace darryl.wallace at prosensus.ca
Thu Mar 11 20:01:17 GMT 2010


Hello,

-----Original Message-----
From: pyqt-bounces at riverbankcomputing.com
[mailto:pyqt-bounces at riverbankcomputing.com] On Behalf Of dizou
Sent: March-11-10 2:54 PM
To: pyqt at riverbankcomputing.com
Subject: Re: [PyQt] Getting a segfault when I close my program


If I take out the line:
treeControlLayout.addItem(self.rightSpacer, 0, 8)
or
viewControlLayout.addItem(self.rightSpacer, 0, 8)
I don't get the segfault anymore.
So I can't have both of those lines of code in.

----

I believe it's because you can't have the "self.rightSpacer" object in two
different places.  My guess is you're getting the segfault because when
the first layout is destroyed it cleans up the self.rightSpacer.  Then
when the second layout is destroyed it's trying to clean up the
self.rightSpacer, but it's been deallocated already.

Try using a different spacer object for each layout, e.g.:
treeControlLayout.addItem(QSpacerItem(10, 0, QSizePolicy.Expanding), 0,8)
viewControlLayout.addItem(QSpacerItem(10, 0, QSizePolicy.Expanding), 0, 8)


Darryl


More information about the PyQt mailing list