[PyKDE] Re: Q___Style wrapper
David Boddie
david at boddie.org.uk
Fri May 12 00:27:44 BST 2006
On Thu, 11 May 2006 15:12:17, Mike Rovner wrote:
> I wrapped QWindowsStyle (attached) and after exiting test application
>
> from PyQt4.QtGui import *
> app = QApplication([])
> app.setStyle(QWindowsStyle())
> lbl = QLabel("Windows")
> lbl.show()
> app.exec_()
>
> got a crash:
>
> (gdb) where
> #0 PyThreadState_New (interp=0x0) at Python/pystate.c:194
> #1 0x080d993c in PyGILState_Ensure () at Python/pystate.c:489
> #2 0xb67cddf5 in initsip ()
> from
> /home/mrovner/tools/linux-x86_32/lib/python2.4/site-packages/sip.so #3
> 0xb6e42b79 in initQtGui ()
> from
> /home/mrovner/tools/linux-x86_32/lib/python2.4/site-packages/PyQt4/QtGui.so
> #4 0xb68f6410 in QApplication::~QApplication() ()
> from /lan/dfm/grp_mm_data1/dev/tools/linux-x86_32/lib/libQtGui.so.4
If you build sip in debug mode, you'll get more information, but I suspect
that there's some confusion about who owns the style after you've passed it
to the QApplication. If PyQt4 is built in debug mode, you should get even
more information about what's going on.
The wrapper for QApplication (sip/QtGui/qapplication.sip) uses a /Transfer/
annotation for the setStyle() function to transfer ownership of the style
object to C++ because the QApplication destructor deletes the style on exit.
It looks like something expects to be deleted or garbage collected when the
QApplication is destroyed, but that maybe the Python interpreter has already
been shut down (interp is zero in frame #0).
If you can show us your .sip file for the QWindowsStyle binding then maybe it
will become clearer just what's happening.
David
More information about the PyQt
mailing list