[PyQt] PyQt5.6 with Python 3.5 Crash

Florian Bruhin me at the-compiler.org
Sat May 20 21:32:09 BST 2017


Hi,

On Sat, May 20, 2017 at 08:53:29PM +0530, Rathinam Signup wrote:
> I did test the same code by porting it back to *PyQt4* and it works without
> any issues. So I can assure you that *the bug is with PyQt 5.6*.

Not necessarily. If anything, the bug would probably be in Qt 5, PyQt is
just a relatively thin wrapper around that.

However, it's also possible something is just different in Qt 4 and
Qt 5, and there's still something wrong with your code (custom models
are *hard*, that's why I said it's way easier to base things on a
QStandardItemModel), and it just didn't show up as a crash on Qt 4.

> Can you please suggest some ways to view the crash report like in
> which thread the crash occured?

With whatever you'd use to do so on your system for other (C++)
applications. For example, DebugDiag on Windows or gdb or coredumpctl on
Linux.

> I set the primary key as User Data in the QAbstractItemModel. When the user
> expands the item I pass this primary key to a QThread which connects with
> the server and when the results are obtained, I add children for the
> corresponding tree item. When the execution hits the line beginInsertRows
> the app crashes.

Are you inserting things into your model from a thread? AFAIK, Qt does
not support that - so if that worked with Qt 4, that was pure luck.

On Sat, May 20, 2017 at 06:32:38PM +0100, Barry wrote:
> > On 19 May 2017, at 12:51, Rathinam Signup <tfa.signup.test at gmail.com> wrote:
> > 
> > class TreeItem(object):
> 
> Should this be derived from QtGui.QStandardItem?

Since it's not a QStandardItemModel, probably not ;-)

On Sat, May 20, 2017 at 10:11:34PM +0530, Rathinam Signup wrote:
> I would like to add that I did test my model with the Model Tester provided
> here https://github.com/bgr/PyQt5_modeltest and didn't find any bugs. Thanks

Even when modifying your model? Note that the pytest-qt model tester
adds some additional tests on top of those, though.

Florian

-- 
https://www.qutebrowser.org  | me at the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072  | https://the-compiler.org/pubkey.asc
         I love long mails!  | https://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170520/34fb3eaf/attachment.sig>


More information about the PyQt mailing list