Re: [PyQt] KConfigSkeleton and pyqt4 API version 2

2010-09-17 Thread Wolfgang Rohdewald
On Freitag 17 September 2010, Hans-Peter Jansen wrote:
> first of all, this is the wrong list for PyKDE issues. Try to
> resend this  to the kde-bindings ML:

will do, thank you for pointing me there.

> You're missing to  create a {Q,K}Application instance here.

not needed for this minimal example, I would have thought.
It certainly shows the same problem as the full application.

But I should have tried with gdb - my code actually gives a
nice backtrace at exit time

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::deleteNode2 (node=0xcf6cff)
at /usr/include/qt4/QtCore/qhash.h:519
#3  0x7428cc6d in QHashData::free_helper (this=0xcf5160, node_delete=
0x747520d0 ::deleteNode2(QHashData::Node*)>)
at tools/qhash.cpp:271
#4  0x7474ee70 in QHash::freeData 
(this=0xcad330, 
__in_chrg=) at /usr/include/qt4/QtCore/qhash.h:568
#5  ~QHash (this=0xcad330, __in_chrg=)
at /usr/include/qt4/QtCore/qhash.h:284
#6  ~Private (this=0xcad330, __in_chrg=)
at ../../kdecore/config/kcoreconfigskeleton_p.h:40
#7  ~KCoreConfigSkeleton (this=0xcad330, __in_chrg=)
at ../../kdecore/config/kcoreconfigskeleton.cpp:1005
#8  0x75e6fecc in sipKConfigSkeleton::~sipKConfigSkeleton() ()
   from /usr/lib/pymodules/python2.6/PyKDE4/kdeui.so
#9  0x75e02cbc in ?? () from 
/usr/lib/pymodules/python2.6/PyKDE4/kdeui.so
#10 0x767a77f9 in ?? () from /usr/lib/pymodules/python2.6/sip.so
#11 0x0046d2d8 in subtype_dealloc (self=)
at ../Objects/typeobject.c:1019
#12 0x0044e577 in insertdict (mp=0x8c8270, key='a', hash=12416037344, 
value=None)
at ../Objects/dictobject.c:459
#13 0x00450a77 in PyDict_SetItem (op=
{'a': None, 'sip': , 'name': 
'tilesetName', '__builtins__': , 
'KConfigSkeleton': 
, 'value': 'I am a value', 
'__package__': None, 's': , '__name__': 
'__main__', 
'__doc__': None}, key='a', value=None)
at ../Objects/dictobject.c:701
#14 0x0045297e in _PyModule_Clear (m=)
at ../Objects/moduleobject.c:138
#15 0x004bb5fa in PyImport_Cleanup () at ../Python/import.c:441
#16 0x004c922f in Py_Finalize () at ../Python/pythonrun.c:438
#17 0x0041a296 in Py_Main (argc=-135380864, argv=)
at ../Modules/main.c:596
#18 0x769d9c4d in __libc_start_main (main=, 
argc=, ubp_av=, init=, 
fini=, rtld_fini=, 
stack_end=0x7fffddc8)
at libc-start.c:226
#19 0x004199f9 in _start ()

-- 
Wolfgang
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] KConfigSkeleton and pyqt4 API version 2

2010-09-17 Thread Hans-Peter Jansen
Hi Wolfgang,

first of all, this is the wrong list for PyKDE issues. Try to resend this 
to the kde-bindings ML:

https://mail.kde.org/mailman/listinfo/kde-bindings

On Friday 17 September 2010, 00:11:18 Wolfgang Rohdewald wrote:
> Hi,
>
> this code prints random output. How should I fix this?
>
> import sip
> sip.setapi('QString', 2)
>
> from PyKDE4.kdeui import KConfigSkeleton

You're missing to  create a {Q,K}Application instance here.
There's also a problem with KApplication:

>>> from PyKDE4.kdeui import KApplication
>>> app = KApplication()


FAILURE (KCmdLineArgs):
Application has not called KCmdLineArgs::init(...).

According to:
http://api.kde.org/4.5-api/kdelibs-apidocs/kdeui/html/classKApplication.html

it should do without any parameter.

> a = KConfigSkeleton()
> name = 'tilesetName'
> value = 'I am a value'
> s = a.addItemString(name, value)
> print s.value()
>
> == output: ==
> value is: 䱀Ɨ!䱠Ɨ彐Ɨ美繈
> *** glibc detected *** python: corrupted double-linked list:
> 0x01975f50 ***

Same here:

(gdb) run
Starting program: /usr/bin/python 
[Thread debugging using libthread_db enabled]
Python 2.6 (r26:66714, Mar 30 2010, 00:30:21) 
[GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4.QtGui import QApplication
>>> from PyKDE4.kdeui import KConfigSkeleton
>>> app = QApplication([])
>>> a = KConfigSkeleton()
>>> name = 'tilesetName'
>>> value = 'I am a value'
>>> s = a.addItemString(name, value)
>>> print s.value()

Program received signal SIGSEGV, Segmentation fault.
memcpy () at ../sysdeps/i386/i686/memcpy.S:100
100 2:  rep
Current language:  auto; currently asm
(gdb) bt
#0  memcpy () at ../sysdeps/i386/i686/memcpy.S:100
#1  0xb67ebe41 in QString::realloc (this=0x834ba38, alloc=137673264) at 
/usr/include/bits/string3.h:52
#2  0xb67ebf86 in QString::realloc (this=0x834ba38) at tools/qstring.cpp:1250
#3  0xb67ebfbe in QString::utf16 (this=0x834ba38) at tools/qstring.cpp:4690
#4  0xb67ec084 in QString::toUcs4 (this=0x834ba38) at tools/qstring.cpp:3574
#5  0xb619aefc in ?? () from /usr/lib/python2.6/site-packages/PyQt4/QtCore.so
#6  0xb60c3f19 in ?? () from /usr/lib/python2.6/site-packages/PyQt4/QtCore.so
#7  0xb7ea4d1f in _PyObject_Str (v=0x82738fc) at Objects/object.c:415
#8  0xb7ea4de5 in PyObject_Str (v=0x82738fc) at Objects/object.c:436
#9  0xb7ea2ea5 in internal_print (op=0x82738fc, fp=0xb7dec4c0, flags=1, 
nesting=0) at Objects/object.c:297
#10 0xb7e8514d in PyFile_WriteObject (v=0x82738fc, f=0xb7c64070, flags=)
at Objects/fileobject.c:116
#11 0xb7ef59bc in PyEval_EvalFrameEx (f=0x834d3bc, throwflag=0) at 
Python/ceval.c:1598
#12 0xb7ef9daf in PyEval_EvalCodeEx (co=0xb7c210f8, globals=0xb7c7702c, 
locals=0xb7c7702c, args=0x0, argcount=0, 
kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at 
Python/ceval.c:2942
#13 0xb7ef1ca3 in PyEval_EvalCode (co=0xb7c210f8, globals=0xb7c7702c, 
locals=0xb7c7702c) at Python/ceval.c:515
#14 0xb7f13b0c in run_mod (mod=, filename=, globals=0xb7c7702c, 
locals=0xb7c7702c, flags=0xbfffebc8, arena=0x804b460) at 
Python/pythonrun.c:1330
#15 0xb7f165fc in PyRun_InteractiveOneFlags (fp=0xb7dec420, filename=0xb7f5118f 
"", flags=0xbfffebc8)
at Python/pythonrun.c:836
#16 0xb7f167d8 in PyRun_InteractiveLoopFlags (fp=0xb7dec420, 
filename=0xb7f5118f "", flags=0xbfffebc8)
at Python/pythonrun.c:756
#17 0xb7f1486f in PyRun_AnyFileExFlags (fp=0xb7dec420, filename=0xb7f5118f 
"", closeit=0, flags=0xbfffebc8)
at Python/pythonrun.c:725
#18 0xb7f20e42 in Py_Main (argc=0, argv=0xbfffec94) at Modules/main.c:597
#19 0x08048692 in main (argc=Cannot access memory at address 0x419d3a4
) at Modules/python.c:23


Python version: 2.6
sip version: 4.10.5
Qt4 version: 4.6.3
PyQt4 version: 4.7.4
PyKDE4 version: 4.4.4

>
> ii  python-qt4
> 4.7.3-1ubuntu2~lucid1~ppa3  Python bindings
> for Qt4
>
> ii  python-kde4
> 4:4.5.1-0ubuntu1~lucid1~ppa1Python bindings
> for the KDE 4 libraries


Pete
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] KConfigSkeleton and pyqt4 API version 2

2010-09-16 Thread Wolfgang Rohdewald
Hi, 

this code prints random output. How should I fix this?

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()

== output: ==
value is: 䱀Ɨ!䱠Ɨ彐Ɨ美繈
*** glibc detected *** python: corrupted double-linked list: 
0x01975f50 ***



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

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


-- 
Wolfgang
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt