[PyKDE] PyQt4 Segmentation Fault - QTableView
Chris Dunscombe
cdunscombe at yahoo.com
Tue Sep 19 19:13:01 BST 2006
Andreas,
Thanks very much it's sorted now!
Chris
PS From what I could see there's no reference to this situation in the docs.
--- Andreas Pakulat <apaku at gmx.de> wrote:
> On 19.09.06 08:44:32, Chris Dunscombe wrote:
> > I now have a simple script to demo the seg fault:
> >
> > from PyQt4.QtCore import *
> > from PyQt4.QtGui import *
> >
> > class mainWindow(QMainWindow):
> > def __init__(self, parent = None):
> > QMainWindow.__init__(self, parent)
> > self.centralWidget = QWidget()
> > self.setCentralWidget(self.centralWidget)
> >
> > model = QStandardItemModel(4, 2)
> > tableView = QTableView()
> > tableView.setModel(model)
>
> There's your problem: The model is garbage collected at the end of
> __init__. The table view's setModel function does not increment the
> refcount on the model!
>
> I don't have a copy of the PyQt4 doc's at hand, but if this is not
> stated on the first page, Phil should probably add it.
>
> I fell into this trap too, a couple of times..
>
> Andreas
>
> --
> You will give someone a piece of your mind, which you can ill afford.
>
> _______________________________________________
> PyKDE mailing list PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the PyQt
mailing list