[Kde-bindings] KConfigSkeleton and pyqt4 API version 2

Wolfgang Rohdewald wolfgang at rohdewald.de
Fri Sep 17 08:59:13 UTC 2010


this code prints random output. How do I correctly
use KConfigSkeleton with the new API? Or do the
kde-bindings not yet support API 2?

import sip
sip.setapi('QString', 2)

from PyKDE4.kdeui import KConfigSkeleton

a = KConfigSkeleton()
name = 'tilesetName'
value = 'I am a value'
s = a.addItemString(name, value)
print s.value()

(gdb) run bug.py
Starting program: /usr/bin/python bug.py
[Thread debugging using libthread_db enabled]
value is: 㟀翿!麨翿刐Ï @翿偈

Program received signal SIGSEGV, Segmentation fault.
~QString (node=0xcf6cff) at /usr/include/qt4/QtCore/qstring.h:882
882     inline QString::~QString() { if (!d->ref.deref()) 
free(d); }
(gdb) bt
#0  ~QString (node=0xcf6cff) at 
/usr/include/qt4/QtCore/qstring.h:882
#1  ~QHashNode (node=0xcf6cff) at 
/usr/include/qt4/QtCore/qhash.h:217
#2  QHash<QString, KConfigSkeletonItem*>::deleteNode2 
(node=0xcf6cff)
    at /usr/include/qt4/QtCore/qhash.h:519
#3  0x00007ffff428cc6d in QHashData::free_helper (this=0xcf5160, 
node_delete=
    0x7ffff47520d0 <QHash<QString, 
KConfigSkeletonItem*>::deleteNode2(QHashData::Node*)>)
    at tools/qhash.cpp:271
#4  0x00007ffff474ee70 in QHash<QString, 
KConfigSkeletonItem*>::freeData (this=0xcad330, 
    __in_chrg=<value optimized out>) at 
/usr/include/qt4/QtCore/qhash.h:568
#5  ~QHash (this=0xcad330, __in_chrg=<value optimized out>)
    at /usr/include/qt4/QtCore/qhash.h:284
#6  ~Private (this=0xcad330, __in_chrg=<value optimized out>)
    at ../../kdecore/config/kcoreconfigskeleton_p.h:40
#7  ~KCoreConfigSkeleton (this=0xcad330, __in_chrg=<value 
optimized out>)
    at ../../kdecore/config/kcoreconfigskeleton.cpp:1005
#8  0x00007ffff5e6fecc in 
sipKConfigSkeleton::~sipKConfigSkeleton() ()
   from /usr/lib/pymodules/python2.6/PyKDE4/kdeui.so
#9  0x00007ffff5e02cbc in ?? () from 
/usr/lib/pymodules/python2.6/PyKDE4/kdeui.so
#10 0x00007ffff67a77f9 in ?? () from 
/usr/lib/pymodules/python2.6/sip.so
#11 0x000000000046d2d8 in subtype_dealloc (self=<KConfigSkeleton 
at remote 0x97cf30>)
    at ../Objects/typeobject.c:1019
#12 0x000000000044e577 in insertdict (mp=0x8c8270, key='a', 
hash=12416037344, value=None)
    at ../Objects/dictobject.c:459
#13 0x0000000000450a77 in PyDict_SetItem (op=
    {'a': None, 'sip': <module at remote 0x7ffff7f03b40>, 'name': 
'tilesetName', '__builtins__': <module at remote 0x7ffff7fa2868>, 
'KConfigSkeleton': <PyQt4.QtCore.pyqtWrapperType at remote 
0xc77e20>, 'value': 'I am a value', '__package__': None, 's': 
<ItemString at remote 0xc3c050>, '__name__': '__main__', 
'__doc__': None}, key='a', value=None)
    at ../Objects/dictobject.c:701
#14 0x000000000045297e in _PyModule_Clear (m=<value optimized 
out>)
    at ../Objects/moduleobject.c:138
#15 0x00000000004bb5fa in PyImport_Cleanup () at 
../Python/import.c:441
#16 0x00000000004c922f in Py_Finalize () at 
../Python/pythonrun.c:438
#17 0x000000000041a296 in Py_Main (argc=-135380864, argv=<value 
optimized out>)
    at ../Modules/main.c:596
#18 0x00007ffff69d9c4d in __libc_start_main (main=<value 
optimized out>, 
    argc=<value optimized out>, ubp_av=<value optimized out>, 
init=<value optimized out>, 
    fini=<value optimized out>, rtld_fini=<value optimized out>, 
stack_end=0x7fffffffddc8)
    at libc-start.c:226
#19 0x00000000004199f9 in _start ()



ii  python-qt4                                         
4.7.3-1ubuntu2~lucid1~ppa3                      Python bindings 
for Qt4

ii  python-kde4                                        
4:4.5.1-0ubuntu1~lucid1~ppa1                    Python bindings 
for the KDE 4 libraries


-- 
Wolfgang



More information about the Kde-bindings mailing list