[PySide] What can be returned from a slot?

Yosef Meller yosefmel at post.tau.ac.il
Sun Jan 13 12:48:30 CET 2013


On Sunday 13 January 2013 12:06:45 Yann Lanthony wrote:
> I've just tested to create a slot like yours (creating and returning an
> instance of my custom model) in my minimal app and I have no segfault.
> Maybe it's because you don't give your  TargetListModel a parent. So you
> create it and immediately return it but no one takes its ownership and it's
> deleted to soon. This might explain the segfault.

Setting a parent works!

If I understand correctly, Python loses its last reference to it (which 
doesn't happen in the wiki example) but when setting a parent PySide increases 
the Python refcount so it doesn't get GCed until the parent object is GCed. 
Does that sound right?

Thanks a lot, 
Yosef.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20130113/b1521427/attachment.html>


More information about the PySide mailing list