[PyQt] Core dump in toPyObject called with an invalid QVariant object

Alexis Boutillier alexis.boutillier at arteris.com
Wed May 20 09:33:06 BST 2009


Hi,

I have a core dump when try to use toPyObject on a QVariant object.
Here is the backtrace :
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208067872 (LWP 17248)]
0x00184b4f in compareTypeDef (key=0x0, el=0x712b208) at siplib.c:6051
6051            while ((ch1 = *s1++) == ' ')
(gdb) bt
#0  0x00184b4f in compareTypeDef (key=0x0, el=0x712b208) at siplib.c:6051
#1  0x009cb479 in bsearch () from /lib/tls/libc.so.6
#2  0x00184c0c in sip_api_find_type (type=0x0) at siplib.c:6077
#3  0x02166493 in Chimera::toAnyPyObject (var=@0x93f7790) at 
qpycore_chimera.cpp:1303
#4  0x021633c3 in qpycore_PyObject_FromQVariant (qvar=@0x93f7790) at 
qpycore_qvariant.cpp:46
#5  0x02047d7c in meth_QVariant_toPyObject (sipSelf=0xb39a97ac, 
sipArgs=0xb7f3b02c) at sip/QtCore/qvariant.sip:179
#6  0x00b91e96 in PyCFunction_Call (func=0xb681c96c, arg=0xb7f3b02c, 
kw=0x712b220) at Objects/methodobject.c:116
#7  0x00befb88 in PyEval_EvalFrameEx (f=0x8e5d39c, throwflag=0) at 
Python/ceval.c:3709
#8  0x00bf149c in PyEval_EvalCodeEx (co=0xb7103770, globals=0x712b220, 
locals=0x0, args=0x8e5d39c, argcount=4, kws=0x0, kwcount=0, defs=0x0, 
defcount=0, closure=0x0) at Python/ceval.c:2968


in : #3  0x02166493 in Chimera::toAnyPyObject (var=@0x93f7790) at 
qpycore_chimera.cpp:1303
1299    // Convert a QVariant to a Python object based on the type of 
the object.
1300    PyObject *Chimera::toAnyPyObject(const QVariant &var)

The QVariant var is invalid :
$3 = (const QVariant &) @0x93f7790: {d = {data = {c = 0 '\0', i = 0, u = 
0, b = false, d = 4.145778293959969e-264, ll = 666732546729443328, ull = 
666732546729443328, ptr = 0x0, shared = 0x0},
     type = 0, is_shared = 0, is_null = 1}, static handler = 0x36335e0}

var.type_name() return 0x0 : QT documentation say that 0x0 could be 
return when QVariant is invalid.
var.isNull() correctly return true

toPyObject should not end in a coreDump on an invalid QVariant.

PyQt : 20090518
sip : 20090430
python : 2.6.2
qt : 4.5.1

Regards,
-- 
Boutillier Alexis
Methodology engineer

Arteris SA
The Network-on-Chip Company TM
www.arteris.net

6 par Ariane Immeuble Mercure
78284 Guyancourt Cedex
France
Office: (+33) 1 61 37 38 71
Fax:    (+33) 1 61 37 38 41
Alexis.Boutillier at arteris.net


More information about the PyQt mailing list