PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 92 - QSpacerItem causing segmentation faults
: QSpacerItem causing segmentation faults
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: QtGui
: 0.2.1
: All All
: P5 normal
Assigned To: renato filho
:
:
:
  Show dependency treegraph
 
Reported: 2009-11-04 15:46 EET by Kamil Kisiel
Modified: 2010-03-24 16:30 EET (History)
5 users (show)

See Also:


Attachments
Qt Designer UI file (8.67 KB, text/xml)
2009-11-04 15:46 EET, Kamil Kisiel
Details
pyside-uic output (10.81 KB, text/x-python-script)
2009-11-04 15:46 EET, Kamil Kisiel
Details
Simple application that loads the layout (429 bytes, text/x-python-script)
2009-11-04 15:47 EET, Kamil Kisiel
Details
QSpacerItem invalid destruction testcase (1.22 KB, text/x-python)
2009-11-19 13:55 EET, Hugues De Keyzer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kamil Kisiel 2009-11-04 15:46:06 EET
Created attachment 23 [details]
Qt Designer UI file

I created a layout using Qt Designer and then attempted to load it in to a
simple application, which caused a segmentation fault. We determined that
commenting out the QSpacerItem instances in the pyside-uic output caused it to
work.

I'm using 0.2.1 on Ubuntu Jaunty.
Comment 1 Kamil Kisiel 2009-11-04 15:46:53 EET
Created attachment 24 [details]
pyside-uic output
Comment 2 Kamil Kisiel 2009-11-04 15:47:22 EET
Created attachment 25 [details]
Simple application that loads the layout
Comment 3 Kamil Kisiel 2009-11-04 15:48:01 EET
I should also note that I tried creating some other simple layouts with spacers
but did not have this problem
Comment 4 renato filho 2009-11-17 16:59:13 EET
This is working fine with PySide git HEAD. Can you test and confirm this?
Comment 5 Hugues De Keyzer 2009-11-19 13:55:51 EET
Created attachment 28 [details]
QSpacerItem invalid destruction testcase

It seems that this problem is related to incorrect ownership of the spacer. The
Qt documentation states that when an item is added to a QLayout with
QLayout::addItem() the ownership of the item is transferred to the layout. If a
QSpacerItem is created locally in a function (as is done in code generated from
a .ui), it will be destroyed at the end of the function, but it shouldn’t
(because it is owned by the QLayout). This works correctly with PyQt.

In the testcase, replacing the two lines by the commented ones prevents the
segmentation fault because the spacer is not destroyed (becaused it is an
instance variable).
Comment 6 renato filho 2009-11-19 15:32:37 EET
I tested this new example in PySide git HEAD version and works. Can somebody 
confirm this?
Comment 7 renato filho 2009-11-24 18:18:39 EET
fixed on PySide release 0.2.2.
Comment 8 Kamil Kisiel 2009-11-25 05:11:39 EET
I can verify this works for me now.

Aside: I notice that I did not receive any email updates regarding comments on
this ticket apart from the last comment notification and that it was closed.