[PyKDE] QTreeWidget's segfaulting on destruction

Phil Thompson phil at riverbankcomputing.co.uk
Tue May 9 09:35:21 BST 2006


On Monday 08 May 2006 10:37 pm, Andreas Pakulat wrote:
> Hi,
>
> replying to another post from here I "accidentally stumbled" accross the
> following segfault (testcase attached):
>
> #0  0x00000369 in ?? ()
> #1  0xb729530f in QTreeModel::clear (this=0x835f1d8) at
> itemviews/qtreewidget.cpp:96 #2  0xb72958d8 in ~QTreeModel (this=0x835f1d8)
> at itemviews/qtreewidget.cpp:79 #3  0xb6ee5e6e in ~QWidget (this=0x835cff8)
> at kernel/qwidget.cpp:1073 #4  0xb7147619 in ~QFrame (this=0x835cff8) at
> widgets/qframe.cpp:212 #5  0xb71d160d in ~QAbstractScrollArea
> (this=0x835cff8)
>     at widgets/qabstractscrollarea.cpp:277
> #6  0xb722e969 in ~QAbstractItemView (this=0x835cff8)
>     at itemviews/qabstractitemview.cpp:429
> #7  0xb725d435 in ~QTreeView (this=0x835cff8) at
> itemviews/qtreeview.cpp:132 #8  0xb7290797 in ~QTreeWidget (this=0x835cff8)
> at itemviews/qtreewidget.cpp:1828 #9  0xb75bd1e1 in ~sipQTreeWidget
> (this=0x835cff8) at sipQtGuipart0.cpp:19283 #10 0xb6ee5e6e in ~QWidget
> (this=0x835b718) at kernel/qwidget.cpp:1073 #11 0xb7924b03 in ~sipQWidget
> (this=0x835b718) at sipQtGuipart3.cpp:84230 #12 0xb7937bb1 in
> release_QWidget (ptr=0x835b718, state=6) at sipQtGuipart3.cpp:91538 #13
> 0xb7937c18 in dealloc_QWidget (sipSelf=0xb7c94b8c) at
> sipQtGuipart3.cpp:91551 #14 0xb7f6ca9a in sipWrapper_dealloc
> (self=0xb7c94b8c) at siplib.c:6073 #15 0x08099a6b in subtype_dealloc
> (self=0xb7c94b8c) at Objects/typeobject.c:703 #16 0x080897d9 in _Py_Dealloc
> (op=0xb7c94b8c) at Objects/object.c:1869 #17 0x08080e80 in insertdict
> (mp=0xb7cd7e94, key=0xb7cc8370, hash=-1947823370, value=0x8150e88) at
> Objects/dictobject.c:397
> #18 0x0808145b in PyDict_SetItem (op=0xb7cd7e94, key=0xb7cc8370,
> value=0x8150e88) at Objects/dictobject.c:551
> #19 0x0812d492 in _PyModule_Clear (m=0xb7cb71b4) at
> Objects/moduleobject.c:136 ---Type <return> to continue, or q <return> to
> quit---
> #20 0x080f148d in PyImport_Cleanup () at Python/import.c:396
> #21 0x080fcf8f in Py_Finalize () at Python/pythonrun.c:352
> #22 0x080560dc in Py_Main (argc=2, argv=0xbfb87a54) at Modules/main.c:504
> #23 0x08055402 in main (argc=2, argv=0xbfb87a54) at Modules/python.c:23
>
> Am I doing something wrong or is this a bug?

I think you are doing something wrong as you are adding both the 
QTreeWidgetItems twice - once by passing a parent to the ctor and also 
explicitly by calls to addChild() and addTopLevelItem().

Qt obviously is just adding each item twice - it's not interpreting it as a 
move from one place to another - so I guess it's calling the dtor twice as 
well.

Phil




More information about the PyQt mailing list