[PyQt] Shutting down an interpreter that has loaded PyQt

Paul A. Giannaros paul at giannaros.org
Wed Feb 18 13:28:35 GMT 2009


I'm hosting a Python interpreter in a Qt app and importing PyQt. That
works great. I can unload the interpreter using Py_Finalize and then
unload the Python library by calling unload() but straight after doing
so the application crashes[1].
Why isn't PyQt4/QtCore.so being unloaded properly, and how can I make
it all do so?

Paul

[1] Traceback:

Thread 1 (Thread 0x7ff99b653750 (LWP 6866)):
#0  0x00007ff997949cb0 in nanosleep () from /lib64/libc.so.6
#1  0x00007ff997949adc in sleep () from /lib64/libc.so.6
#2  0x00007ff99a593d2f in KCrash::startDrKonqi (argv=0x7fffa36951f8,
argc=17) at /usr/src/debug/kdelibs-4.2.0/kdeui/util/kcrash.cpp:412
#3  0x00007ff99a59468a in KCrash::defaultCrashHandler (sig=11) at
/usr/src/debug/kdelibs-4.2.0/kdeui/util/kcrash.cpp:337
#4  <signal handler called>
#5  0x00007ff98e78d353 in PyThreadState_New () from
/usr/lib64/libpython2.6.so.1.0
#6  0x00007ff98e78d7ae in PyGILState_Ensure () from
/usr/lib64/libpython2.6.so.1.0
#7  0x00007ff98dfcbbdf in ?? () from
/usr/lib64/python2.6/site-packages/PyQt4/QtCore.so
#8  0x00007ff98dfcbd0b in ?? () from
/usr/lib64/python2.6/site-packages/PyQt4/QtCore.so
#9  0x00007ff9986ed105 in QObject::event (this=0x6c0620, e=0x734cd0)
at kernel/qobject.cpp:1155
#10 0x00007ff99921c1bd in QApplicationPrivate::notify_helper(QObject*,
QEvent*) () from /usr/lib64/libQtGui.so.4
#11 0x00007ff999223f8a in QApplication::notify(QObject*, QEvent*) ()
from /usr/lib64/libQtGui.so.4
#12 0x00007ff99a531b3b in KApplication::notify (this=0x7fffa36962a0,
receiver=0x6c0620, event=0x734cd0) at
/usr/src/debug/kdelibs-4.2.0/kdeui/kernel/kapplication.cpp:307
#13 0x00007ff9986de091 in QCoreApplication::notifyInternal
(this=0x7fffa36962a0, receiver=0x6c0620, event=0x734cd0) at
kernel/qcoreapplication.cpp:587
#14 0x00007ff9986ded3a in QCoreApplicationPrivate::sendPostedEvents
(receiver=0x0, event_type=0, data=0x603e40) at
kernel/qcoreapplication.h:209
#15 0x00007ff998706863 in postEventSourceDispatch (s=<value optimized
out>) at kernel/qcoreapplication.h:214
#16 0x00007ff992f5b0db in g_main_context_dispatch () from
/usr/lib64/libglib-2.0.so.0
#17 0x00007ff992f5e8ad in ?? () from /usr/lib64/libglib-2.0.so.0
#18 0x00007ff992f5ea6b in g_main_context_iteration () from
/usr/lib64/libglib-2.0.so.0
#19 0x00007ff9987064ef in QEventDispatcherGlib::processEvents
(this=0x61dfc0, flags=<value optimized out>) at
kernel/qeventdispatcher_glib.cpp:319
#20 0x00007ff9992ac97f in ?? () from /usr/lib64/libQtGui.so.4
#21 0x00007ff9986dc9a2 in QEventLoop::processEvents (this=<value
optimized out>, flags={i = -1553374912}) at kernel/qeventloop.cpp:143
#22 0x00007ff9986dcb2d in QEventLoop::exec (this=0x7fffa3696180,
flags={i = -1553374832}) at kernel/qeventloop.cpp:194
#23 0x00007ff9986deffd in QCoreApplication::exec () at
kernel/qcoreapplication.cpp:845
#24 0x00007ff99b276ca5 in kdemain (argc=3, argv=0x7fffa3697488) at
/usr/src/debug/kdesdk-4.2.0/kate/app/katemain.cpp:250
#25 0x00007ff9978c6586 in __libc_start_main () from /lib64/libc.so.6
#26 0x0000000000400779 in _start () at ../sysdeps/x86_64/elf/start.S:113


More information about the PyQt mailing list