[PySide] PySide Pitfalls

Stephan Deibel sdeibel at wingware.com
Mon Sep 15 16:12:40 CEST 2014


Nathan Warmerdam wrote:
> TL;DR - What are some common gotchas that can lead to a crash even in 
> a simple PySide application.

One is trying to keep a reference to any wrapped object that is not a 
descendent of QObject.  There is no life cycle management so the 
underlying C++ object can be freed and the Python reference can even be 
replaced with another C++ object.  I've seen this with QEvents in the 
context of event filters and it also applies to QIcon, QStandardItem, 
and QListWidgetItem, which maybe is a clue to why it crashed in your case.

Not sure if this will be helpful or not but it's worth knowing about...

- Stephan




More information about the PySide mailing list