[PyQt] [PyKDE4] Crash when using KConfig

Adeodato Simó dato at net.com.org.es
Fri Feb 15 10:08:04 GMT 2008


* Simon Edwards [Thu, 14 Feb 2008 22:59:49 +0100]:

> Adeodato Simó wrote:
>> Hello, any news about this?

> This works. (see attachment).

Oh. Well, it doesn't crash, but it's not quite the same, since that
writes to the session config (~/.kde/share/config/session/test_... vs. 
~/.kde/share/config/testrc).

*However*, it gave me an idea, don't ask me why. Basically, keeping a
reference to the object...:

--- 02_kconfig_crash.py~
+++ 02_kconfig_crash.py
@@ -12,9 +12,10 @@
 class MainWindow(kdeui.KMainWindow):
     def __init__ (self, *args):
         kdeui.KMainWindow.__init__(self, *args)
-        kdecore.KGlobal.config().group('Foo').writeEntry('a', 'b')
+        self.config = kdecore.KGlobal.config()
+        self.config.group('Foo').writeEntry('a', 'b')
         print '=== syncing now ===' # not reached
-        kdecore.KGlobal.config().sync()
+        self.config.sync()

 def main():
     kdecore.KCmdLineArgs.init(sys.argv, 'test', '', kdecore.ki18n('test'), '1.0')


Thanks for looking into this, and for the inspiration!

-- 
Adeodato Simó                                     dato at net.com.org.es
Debian Developer                                  adeodato at debian.org
 
                                          Listening to: Family - El Mapa



More information about the PyQt mailing list