[PyKDE] Reduced testcase for lambda-related crash

Giovanni Bajo rasky at develer.com
Sat Feb 3 15:53:51 GMT 2007


Hi Phil,

I managed to reduce another small crashing testcase:

==========================================
#!/usr/bin/env python
from qt import *
import weakref

class myref(weakref.ref):
     pass

a = QObject(None)
wr = myref(a)
wr._callback = lambda: wr
QObject.connect(a, SIGNAL("destroyed()"), wr._callback)
del a
print "OK!"
==========================================


Purify gives me this output:


[W] UMR: Uninitialized memory read in sip_api_emit_to_slot {1 occurrence}
     Reading 4 bytes from 0x0276aec0 (4 bytes at 0x0276aec0 uninitialized)
     Address 0x0276aec0 is 72 bytes into a 80 byte block at 0x0276ae78
     Address 0x0276aec0 points to a C++ new block in heap 0x02640000
     Thread ID: 0x7bc


     Error location

     sip_api_emit_to_slot [sip\siplib\qtlib.c:614]
                 return 0;
             }

  =>         if ((sfunc = PyMethod_New(slot->meth.mfunc, self, 
slot->meth.mclass)) == NULL)
             {
                 Py_XDECREF(sref);
                 return -1;
     UniversalSlot::qt_invoke(int,QUObject *) [pyqt\sip\qt\qobject.sip:1202]
             }

             // Dispatch to the real slot.
  =>         if (ok && sipEmitToSlot(&conn.sc_slot, argtup) < 0)
                 ok = FALSE;

             Py_DECREF(argtup);
     QObject::activate_signal(QConnectionList *,QUObject *) [qt.pyd]
     QObject::activate_signal(int) [qt.pyd]
     QObject::destroyed(void) [qt.pyd]
     sipQObject::~sipQObject(void) [qt.pyd]
     sipQObject::`scalar deleting destructor'(UINT) [qt.pyd]
     release_QObject [qt.pyd]
     dealloc_QObject [qt.pyd]
     sipWrapper_dealloc [sip\siplib\siplib.c:6379]
     subtype_dealloc [d:\python-2.4.2\objects\typeobject.c:703]
     PyDict_DelItem [d:\python-2.4.2\objects\dictobject.c:601]
     dict_ass_sub   [d:\python-2.4.2\objects\dictobject.c:893]
     PyObject_DelItem [d:\python-2.4.2\objects\abstract.c:155]
     PyEval_EvalFrame [d:\python-2.4.2\python\ceval.c:1715]


     Allocation location

      [C:\Python24\MSVCR71.dll ip=0x5C367F07]
     sipQtCreateUniversalSlot [pyqt\sip\qt\qobject.sip:1250]
         if (tx && PyObject_TypeCheck(tx, (PyTypeObject *)sipClass_QObject))
                 qtx = reinterpret_cast<QObject *>(conn->sc_transmitter);

      =>     return new UniversalSlot(qtx, conn, member);
         }


     createUniversalSlot [sip\siplib\qtlib.c:447]
                 return 0;

             /* Parse the signature and create the universal slot. */
      =>     if ((conn.sc_signature = parseSignature(sig)) == NULL || 
(us = sipQtSupport->qt_create_universal_slot(txSelf, &conn, member)) == 
NULL)
             {
                 sip_api_free_connection(&conn);
                 return 0;
     sip_api_convert_rx [sip\siplib\qtlib.c:916]
                      const char *slot,const char **memberp)
         {
             if (slot == NULL)
      =>         return createUniversalSlot(txSelf, sig, rxObj, NULL, 
memberp);

             if (isQtSlot(slot) || isQtSignal(slot))
             {
     sip_api_connect_rx [sip\siplib\qtlib.c:962]
     meth_QObject_connect [pyqt\qt\qobject.sip:603]
     PyCFunction_Call [d:\python-2.4.2\objects\methodobject.c:73]
     call_function  [d:\python-2.4.2\python\ceval.c:3558]
     PyEval_EvalFrame [d:\python-2.4.2\python\ceval.c:2163]
     PyEval_EvalCodeEx [d:\python-2.4.2\python\ceval.c:2736]


Hope this helps!
-- 
Giovanni Bajo




More information about the PyQt mailing list