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 841 - QStandardItem::clone and QStandardItemModel::setItemPrototype
: QStandardItem::clone and QStandardItemModel::setItemPrototype
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: QtGui
: HEAD
: PC MS Windows XP/Vista/7
: P2 normal
Assigned To: renato filho
:
:
:
  Show dependency treegraph
 
Reported: 2011-04-27 19:49 EEST by Martin Preisler
Modified: 2011-05-26 17:03 EEST (History)
9 users (show)

See Also:


Attachments
Failing application (1.90 KB, text/plain)
2011-04-28 18:45 EEST, Martin Preisler
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Preisler 2011-04-27 19:49:21 EEST
Hi!

I have implemented a simple drag and drop project management gui and python
keeps crashing whenever standard item model clones an item via the prototype
(if I don't set the prototype from python everything works).

I have worked extensively with py++ and boost::python but have only glanced at
shiboken so I might be wrong but I think the cloned instances are being
instantly garbage collected because nothing is taking ownership of them (and
upon returning them their ref count is 0).

The code in question:
http://crayzedsgui.hg.sourceforge.net/hgweb/crayzedsgui/CEED/file/6efa28938b3d/project.py#l92

The work around listed there works flawlessly but obviously isn't good in the
long run. It basically creates memory leaks.

I am using PySide nightly builds with Python 2.7 on Windows 7.
Comment 1 Hugo Parente Lima 2011-04-28 16:47:17 EEST
Thanks for reporting, but if it's not too much could you provide a small code
example showing only this issue? Will ease our job :-)
Comment 2 Martin Preisler 2011-04-28 18:45:37 EEST
Created attachment 319 [details]
Failing application

Contains a lot of boilerplate code but is standalone, just python and pyside
should suffice.

If you uncomment the workaround code it will work, comment it again and it will
segfault.
Comment 3 Martin Preisler 2011-04-28 18:47:01 EEST
(In reply to comment #2)
> Created attachment 319 [details]
> Failing application
> 
> Contains a lot of boilerplate code but is standalone, just python and pyside
> should suffice.
> 
> If you uncomment the workaround code it will work, comment it again and it will
> segfault.

oh stupid me... the segfault is triggered by drag moving any of the items in
the model. It happens upon dropping the item.
Comment 4 renato filho 2011-05-03 21:06:05 EEST
fixed on pyside commit:

commit 13d505c9c0a08381113154fd0880b6ac64e7ebf3
Author: Renato Filho <renato.filho@openbossa.org>
Date:   Tue May 3 12:21:10 2011 -0300
Comment 5 renato filho 2011-05-26 17:03:54 EEST
PySide release 1.0.3