[Kde-bindings] [Bug 267040] pyKDE crashes when using KApplication and some imports

Simon Edwards simon at simonzone.com
Thu Feb 24 21:27:19 UTC 2011


https://bugs.kde.org/show_bug.cgi?id=267040


Simon Edwards <simon at simonzone.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |simon at simonzone.com
     Ever Confirmed|0                           |1




--- Comment #1 from Simon Edwards <simon simonzone com>  2011-02-24 22:26:53 ---
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()

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Kde-bindings mailing list