[PyQt] PyQt5.6 with Python 3.5 Crash

Rathinam Signup tfa.signup.test at gmail.com
Mon May 22 08:28:37 BST 2017


Hi Florian,

Thanks for the response.

>custom models are *hard*, that's why I said it's way easier to base things
on a >QStandardItemModel

I'll check by changing my model from QAbstractItemModel to
QStandardItemModel. I'll also try to test the same with the latest
PyQt(5.8.x) version also.

>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.

Can you suggest any equivalent tools in Python?

>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.

I'm using a QThread here to fetch children items from server. It must be
noted that I'm not passing the model indexes here. Instead I pass a key and
just before inserting the rows, I retrieve the parent index from the model
that corresponds to the particular key. Will try pytest-qt to test my model
also. Thanks.

On Sun, May 21, 2017 at 2:02 AM, Florian Bruhin <me at the-compiler.org> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170522/b8589ba8/attachment.html>


More information about the PyQt mailing list