[PySide] Problems with QStyle deletion

John Ehresman jpe at wingware.com
Fri Nov 30 15:55:01 CET 2012


On 11/29/12 4:06 PM, Nik Melchior wrote:
> On Mon, Nov 26, 2012 at 01:49:37PM -0500, John Ehresman wrote:
>> On 11/15/12 5:52 PM, John Ehresman wrote:
>>> I'm trying to fix a bug that causes segfaults if QApplication.style() and
>>> QApplication.setStyle() are used repeatedly.  I think the issue is:
> 
> John,
> 
> My application has random crashes due to QStyle objects as well.  I had some
> trouble tracking down the problem, and I originally thought it was related to
> a bug that reported QNetworkReply objects being randomly returned.  I added my
> analysis to PySide bug #16, but I haven't seen any activity there.

I think this a symptom of the same object lifecycle bug -- PySide
doesn't always detect when a C++ object is no longer valid and when that
happens a bad entry gets left in the hash table mapping C++ object
addresses to Python wrapper objects.  When another C++ object is created
at the same address, PySide will find the bad entry in the hash table
and reuse the old wrapper.

A fix went into shiboken in June that fixes a few cases that can lead to
this with event objects, but I don't know if there's been a release
since then.  Your bug with eventFilters sounds a lot like a bug I was
seeing and the shiboken fix did seem to address them.

I also think this problem might be solved more generically; I have a fix
for QObject derived classes that I think might work.  Other classes will
need a different approach, but I do think something can be done for them.

Cheers,

John



More information about the PySide mailing list