Created attachment 57493 [details] Source file causing crash Version: unspecified (using KDE 4.6.0) OS: Linux When calling KApplication and for a particular combination of imports the application crashes when closed (by clicking on close button of window, one can also a Quit-button and close by clicking on it). Note that the particular imports are relevant, removing for instance QVBoxLayout causes it to not crash. Reproducible: Always Steps to Reproduce: 1. Start the application. 2. Click on close window button. Actual Results: Crash Expected Results: Normal closure of application Backtrace: Application: Kontour (python2.6), signal: Segmentation fault [KCrash Handler] #7 0x06321162 in QX11WindowSurface::~QX11WindowSurface (this=0x899f290, __in_chrg=<value optimized out>) at painting/qwindowsurface_x11.cpp:84 #8 0x0631a4d9 in QWidgetBackingStore::~QWidgetBackingStore (this=0x8997e30, __in_chrg=<value optimized out>) at painting/qbackingstore.cpp:883 #9 0x061187ab in QWidgetBackingStoreTracker::destroy (this=0x8966680) at kernel/qwidget.cpp:205 #10 0x0611a761 in QWidgetPrivate::deleteExtra (this=0x8962c40) at kernel/qwidget.cpp:1739 #11 0x0611a9af in QWidgetPrivate::~QWidgetPrivate (this=0x8962c40, __in_chrg=<value optimized out>) at kernel/qwidget.cpp:318 #12 0x04710f81 in cleanup (this=0x89602b0, __in_chrg=<value optimized out>) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:62 #13 ~QScopedPointer (this=0x89602b0, __in_chrg=<value optimized out>) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:100 #14 QObject::~QObject (this=0x89602b0, __in_chrg=<value optimized out>) at kernel/qobject.cpp:963 #15 0x061299c6 in QWidget::~QWidget (this=0x89602b0, __in_chrg=<value optimized out>) at kernel/qwidget.cpp:1609 #16 0x03431771 in ?? () from /usr/lib/pymodules/python2.6/PyQt4/QtGui.so #17 0x033e6d23 in ?? () from /usr/lib/pymodules/python2.6/PyQt4/QtGui.so #18 0x033e6d99 in ?? () from /usr/lib/pymodules/python2.6/PyQt4/QtGui.so #19 0x007aea0f in ?? () from /usr/lib/pymodules/python2.6/sip.so #20 0x007aea61 in ?? () from /usr/lib/pymodules/python2.6/sip.so #21 0x080a8d03 in subtype_dealloc (self=<unknown at remote 0x7bcff4>) at ../Objects/typeobject.c:1019 #22 0x0808c4d9 in insertdict (mp=0xb78a124c, key='v', hash=-2075823753, value=None) at ../Objects/dictobject.c:459 #23 0x0808e837 in PyDict_SetItem (op={'ki18n': None, 'appName': None, 'QVBoxLayout': None, 'app': None, 'QObject': None, 'KAboutData': None, '__package__': None, 'KCmdLineArgs': None, 'version': None, 'QWidget': None, '__doc__': None, 'KApplication': None, '__builtins__': <module at remote 0xb786f074>, '__file__': None, 'aboutData': None, 'sys': None, 'catalog': None, 'programName': None, '__name__': None, 'QRect': None, 'SIGNAL': None, 'v': None}, key='v', value=None) at ../Objects/dictobject.c:701 #24 0x080904c3 in _PyModule_Clear (m=<module at remote 0xb786f11c>) at ../Objects/moduleobject.c:138 #25 0x080effa5 in PyImport_Cleanup () at ../Python/import.c:441 #26 0x080fd19c in Py_Finalize () at ../Python/pythonrun.c:444 #27 0x080fc84c in Py_Exit () at ../Python/pythonrun.c:1758 #28 handle_system_exit () at ../Python/pythonrun.c:1132 #29 0x080fcdf5 in PyErr_PrintEx (set_sys_last_vars=<value optimized out>) at ../Python/pythonrun.c:1142 #30 0x080fdc9b in PyRun_SimpleFileExFlags (fp=0xbfd9a0d3, filename=0xbfd9a0d3 "ontour", closeit=1, flags=0xbfd98cdc) at ../Python/pythonrun.c:945 #31 0x0805b6d3 in Py_Main (argc=2, argv=0xbfd98dc4) at ../Modules/main.c:577 #32 0x0805a8ab in main (argc=2, argv=0xbfd98dc4) at ../Modules/python.c:23
This is a known issue. It only shows up in trivial programs like this one and is easily worked around. It is a long story but KApplication needs to be last object destroyed when your application shuts down. This is easy enough to fix by just putting most of your code inside a function which is cleaned up after returning and before KApplication is cleaned up. See below. ---------------------------------- #!/usr/bin/python import sys from PyKDE4.kdeui import KApplication from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs from PyQt4.QtGui import QWidget,QVBoxLayout from PyQt4.QtCore import QRect,QObject,SIGNAL appName = "Kontour" catalog = "" programName = ki18n ("Kontour") version = "0.3" def main(): global app aboutData = KAboutData (appName, catalog, programName, version) KCmdLineArgs.init (sys.argv,aboutData) app = KApplication() v = QWidget() v.show() app.exec_() main()
*** This bug has been marked as a duplicate of bug 256625 ***