[PyQt] Help understanding a backtrace

Kovid Goyal kovid at kovidgoyal.net
Mon Jan 30 12:13:30 GMT 2012


I was able to trace the python code that is triggering the assert. 

Basically, it is the following sequence:

view = self.parent() 
At this point view is a subclass of QMainWindow and view.parent() returns None
Calling view.size() causes the assert to be triggered. Interestingly the assert
is only triggered the second time this code is run, which tells me that
probably the underlying Qt object corresponding to view has been deleted. view
is the main window of the application, there is reference to it kept at the
python level.

Note that this is only one instance where the assert is triggered, I am fairly
certain that there will be several unrelated code paths throughout calibre that
will trigger it, given the various crashes I have experienced.

Reading the SIP changelog, one thing of note: The QMainWindow subclass has
multiple inheritance. It is defined as

class EbookViewer(MainWindow, Ui_EbookViewer):

where Ui_EbookViewer comes from a compiled .ui file and MainWindow is a simple
subclass of QMainWindow. The definition of EbookViewer is here: http://bazaar.launchpad.net/~kovid/calibre/trunk/view/head:/src/calibre/gui2/viewer/main.py#L171
and the MainWindow class is:
http://bazaar.launchpad.net/~kovid/calibre/trunk/view/head:/src/calibre/gui2/main_window.py#L90

Let me know if there's anything else I can do.

Kovid.

On Sun, Jan 29, 2012 at 10:14:48PM +0000, Phil Thompson wrote:
> On Sun, 29 Jan 2012 22:20:26 +0530, Kovid Goyal <kovid at kovidgoyal.net>
> wrote:
> > Got another crash, with the addition of SIP_ALIAS. The backtrace is a
> > little
> > different, now the crash happens in PyObject__GcUntrack called from
> > removeParent (backtrace attached).
> > 
> > To be clear this is running off sip 4.13.1 release tarball with the
> first
> > change you asked for (addition of SIP_ALIAS in object_add())
> > 
> > How would you like me to proceed?
> 
> Backout that change and apply the second one.
> 
> Phil
> 
> !DSPAM:3,4f25c4da18598762377731!
> 
> 

-- 
_____________________________________

Dr. Kovid Goyal 
http://www.kovidgoyal.net
http://calibre-ebook.com
_____________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20120130/ac8dc2c6/attachment.pgp>


More information about the PyQt mailing list