Hello experts,
I have registered here for help because I am having a SEGFAULT crash problem that is difficult for me to track down as I cannot reproduce it on demand, is included in quite a large project and takes normally over two hours only to happen randomly. For the record, I am using PyQt5 but I do not think it actually makes a difference. The only clue I have is from the wrapped C++:
Program received
signal SIGSEGV, Segmentation fault. 0x00007ffff5f65554 in
QGraphicsItem::parentItem (this=this@entry=0x7ffff79fe5d0 <type_call>) at graphicsview/qgraphicsitem.cpp:1550
1550 return d_ptr->parent;
Program received signal SIGSEGV, Segmentation fault. 0x00007ffff5f65554 in QGraphicsItem::parentItem
(this=this@entry=0x7ffff79fe5d0 <type_call>) at graphicsview/qgraphicsitem.cpp:1550
1550 return d_ptr->parent;
To copy to clipboard, switch view to plain text mode
The full backtrace is here.The top few lines are:
#0 0x00007ffff5f65554 in QGraphicsItem::parentItem (this=this@entry=0x7ffff79fe5d0 <type_call>)
at graphicsview/qgraphicsitem.cpp:1550
#1 0x00007ffff5f6557b in QGraphicsItem::topLevelItem (this=this@entry=0x555555e06350) at graphicsview/qgraphicsitem.cpp:1563
#2 0x00007ffff5fb44ee in QGraphicsSceneFindItemBspTreeVisitor::visit (this=0x555557d853e0, items=0x555557f72f48)
at graphicsview/qgraphicsscene_bsp.cpp:72
#0 0x00007ffff5f65554 in QGraphicsItem::parentItem (this=this@entry=0x7ffff79fe5d0 <type_call>)
at graphicsview/qgraphicsitem.cpp:1550
#1 0x00007ffff5f6557b in QGraphicsItem::topLevelItem (this=this@entry=0x555555e06350) at graphicsview/qgraphicsitem.cpp:1563
#2 0x00007ffff5fb44ee in QGraphicsSceneFindItemBspTreeVisitor::visit (this=0x555557d853e0, items=0x555557f72f48)
at graphicsview/qgraphicsscene_bsp.cpp:72
To copy to clipboard, switch view to plain text mode
My first thought was that I was looking up a parentItem while it had already been deleted, but can an item deletion really trigger while painting some of its children?!
I have thought of reworking the whole code never to use that method (not that it is inherently buggy but I would learn something if the problem happens again... or be frustratingly happy if it does not), but my analysis of this today---which I find puzzling---is not really that the parentItem is NULL, but that an internal pointer in the parentItem method's implemention is NULL and dereferenced, and I have no clue where that can come from.
Would somebody have something helpful in mind?
Thank you for your time.
Bookmarks