[PyQt] Object ownership bug in QGraphicsScene::setStyle()

Phil Thompson phil at riverbankcomputing.com
Thu Aug 5 08:27:51 BST 2010


On Thu, 5 Aug 2010 01:03:20 +0200, Max Schwarz <Max at x-quadraht.de> wrote:
> Hi,
> 
> I think I have discovered a bug in PyQt.
> 
> QGraphicsScene.setStyle() does not move ownership of the style to C++,
but
> Qt 
> reparents the style to the scene and deletes it at exit, which causes a 
> segmentation fault if the python interpreter tries to delete it as well.
> 
> See the attachment for a minimal sample.
> 
> I believe line 314 of sip/qgraphicsscene.sip is to blame:
> 
> %If (Qt_4_4_0 -)
>     void setStyle(QStyle *);
> %End
> 
> I did not delve deeply into sip, but I think a /Transfer/ annotation is 
> missing.
> 
> My PyQt4 version: 4.7.3-1ubuntu2~lucid1~ppa2 from the kubuntu beta ppa,
I
> did 
> not check if the issue still remains with more current versions.

You're right - thanks.

Phil


More information about the PyQt mailing list