[PyKDE] ListViewItem/setStyle segfault

Jason Lai jmlai at uci.edu
Mon Apr 19 07:45:01 BST 2004


This only seems to occur when trying to switch styles to "plastik", but 
not in the C++ Qt.

Crashing/segfaulting code (requires plastik):
--------
import sys
from qt import *

def main(args):
     app = QApplication(args)

     listview  = QListView()
     app.setMainWidget(listview)

     listview.addColumn("A column")
     item    = QListViewItem(listview, "An item")
     subitem = QListViewItem(item, "A subitem")
     item.setOpen(True)

     listview.show()

     app.setStyle("plastik")

     app.exec_loop()

main(sys.argv)
--------
Part of the GDB output for "python crash.py"
--------
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 17486)]
0x4114b251 in QGList::find(void*, bool) (this=0x81bfe60, d=0x41736204,
     fromStart=true) at tools/qglist.cpp:751
751     tools/qglist.cpp: No such file or directory.
         in tools/qglist.cpp
--------
Non-crashing C++ code (is this equivalent?):
--------
#include <qapplication.h>
#include <qlistview.h>

int main(int argc, char **argv)
{
     QApplication *a = new QApplication(argc, argv);
     QListView *listview = new QListView();
     a->setMainWidget(listview);

     qlv->addColumn("A column");
     QListViewItem *item = new QListViewItem(listview,"An item");
     QListViewItem *subitem = new QListViewItem(item, "A subitem");
     item->setOpen(TRUE);

     listview->show();
     a->setStyle("plastik");
     return a->exec();
}
--------

Environment:
PyQt: 3.11
PyKDE: not installed
SIP: 4.0_rc3
KDE: 3.2.1
Qt:  3.3.0

Moving the app.setStyle to the top avoids the crash. So does changing 
the argument to something other than "plastik". The crash only occurs 
when the program exits. Removing setOpen() avoids the crash, so does 
calling setOpen(False) before setStyle is called.

Does this look like a PyQt problem or a Qt/KDE/Plastik problem?

-- 
Jason Lai
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3154 bytes
Desc: S/MIME Cryptographic Signature
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20040419/4bb1d4d2/smime.bin


More information about the PyQt mailing list