[PyQt] getting reference to a QPainter crashes application
Matt Chambers
chambers at imageworks.com
Sat Sep 22 01:55:45 BST 2007
Currently I'm running the latest PyQT 4.3 snapshot with the offical 4.3
release of Sip and Qt 4.3.1, although the problem is still there with
PyQt 4.3 official release.
What I have is a QWidget which is basically my own type of progress bar
embedded in a QTreeWidgetItem.
progressBar = jobProgressBar.JobProgressBar(cjob,self)
self.setItemWidget(item, self.columnCount() -1, progressBar)
in jobProgressBar.JobProgressBar I override paintEvent to draw my custom
progress bar.
I'm getting two types of crashes, one where the qpainter pointer is
freed but its already null, and one where the qpainter pointer address
changes during destruction. Its basically the same stack trace except
isActive shows a different memory address than the previous line.
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1217782864 (LWP 20039)]
0x024bfbd8 in QPainter::isActive (this=0x0) at painting/qpainter.cpp:1092
1092 painting/qpainter.cpp: No such file or directory.
in painting/qpainter.cpp
Current language: auto; currently c++
(gdb) where
#0 0x024bfbd8 in QPainter::isActive (this=0x0) at
painting/qpainter.cpp:1092
#1 0x024c359f in ~QPainter (this=0xa6a8fd0) at painting/qpainter.cpp:1064
#2 0x013b8ab7 in release_QPainter (ptr=0xa6a8fd0) at
sipQtGuiQPainter.cpp:4583
#3 0x013b8b00 in dealloc_QPainter (sipSelf=0xb314aa6c) at
sipQtGuiQPainter.cpp:4594
#4 0x001a90e6 in initsip () from /usr/local/lib/python2.4/pyqt-4.3/sip.so
#5 0x00255e2f in subtype_dealloc (self=0xb314aa6c) at
Objects/typeobject.c:703
The funny thing is, this happens just by getting a reference to a
QPainter, I don't actually have to paint anything. For example, this is
enough to do it:
def paintEvent(self,e):
p = QtGui.QPainter(self)
--
-Matt
<http://twiki.spimageworks.com/twiki/bin/view/Software/CueDevelopment>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070922/78e12f24/attachment.html
More information about the PyQt
mailing list