[PyKDE] Re: Q___Style wrapper
david at boddie.org.uk
david at boddie.org.uk
Fri May 12 15:12:36 BST 2006
On Thu, 11 May 2006 17:13:54, Mike Rovner wrote:
> David Boddie wrote:
> > 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).
>
> Agree.
>
> > If you can show us your .sip file for the QWindowsStyle binding then
> > maybe it will become clearer just what's happening.
>
> I did ;) It's included in my original message.
Looks like I didn't scroll down far enough. :-/
I think your original backtrace probably gives us the information we need.
Still, I compiled SIP, PyQt, and ExtraStyles (my name for the new module)
with debugging symbols, and got the following backtrace:
#0 PyThreadState_New (interp=0x0) at Python/pystate.c:194
#1 0xb7ee1560 in PyGILState_Ensure () at Python/pystate.c:489
#2 0xb7e21c8c in sip_api_common_dtor (sipSelf=0xb7b40b2c) at siplib.c:3014
#3 0xb674a860 in ~sipQWindowsStyle (this=0x8230768) at
sipExtraStylesQWindowsStyle.cpp:46
#4 0xb6e05400 in ~QApplication (this=0x80faf90) at
kernel/qapplication.cpp:854
#5 0xb780b198 in ~sipQApplication (this=0x80faf90) at sipQtGuipart3.cpp:47410
#6 0xb752018c in sipDelayedDtors (ddlist=0x8142c00) at qapplication.sip:396
#7 0xb7e1e76c in finalise () at siplib.c:883
#8 0xb7ee366a in Py_Finalize () at Python/pythonrun.c:1564
#9 0xb7eea3b3 in Py_Main (argc=1, argv=0xbf854964) at Modules/main.c:504
#10 0x08048654 in main (argc=2, argv=0xbf854964) at Modules/python.c:23
Frame 4 looks interesting:
(gdb) f 4
#4 0xb6e05400 in ~QApplication (this=0x80faf90) at
kernel/qapplication.cpp:854
854 delete QApplicationPrivate::app_style;
Current language: auto; currently c++
(gdb) l
849 QApplicationPrivate::set_pal = 0;
850 app_palettes()->clear();
851 delete QApplicationPrivate::app_font;
852 QApplicationPrivate::app_font = 0;
853 app_fonts()->clear();
854 delete QApplicationPrivate::app_style;
855 QApplicationPrivate::app_style = 0;
856 delete QApplicationPrivate::app_icon;
857 QApplicationPrivate::app_icon = 0;
858 #ifndef QT_NO_CURSOR
So, the style is being deleted here, so in frame 3 the QWindowsStyle
wrapper is destroyed.
I think the problem is that all this is happening after Python has been
shut down, maybe because QApplication is defined using the /DelayDtor/
annotation in sip/QtGui/qapplication.sip. Just to test my theory, I
removed the annotation (but not the annotation for QCoreApplication), and
I didn't get a segfault on exit.
Maybe someone with more experience can suggest a workaround, or perhaps
there's room for some changes in the QApplication wrapper. I expect that
there was a good reason to use the annotation there, though perhaps just
keeping it for QCoreApplication is sufficient to solve any previous issues.
David
More information about the PyQt
mailing list