Hi all, I am having trouble connecting signals in a PySide wrapped QObject derived object to Python code with a segmentation fault occurring in the connect call. Other calls to the object work well and the signal is visible on the object. Connecting to signals on objects supplied by PySide works.
The original issue was in a complex object so I have built a small example which demonstrates the same problem. This is using the 1.0.3 source package downloads from http://developer.qt.nokia.com/wiki/Category:LanguageBindings::PySide::Downloads. The problem occurs on Ubuntu 11.04 with Qt 4.7.2 as well as on a fresh install of Ubuntu 10.04 with Qt 4.6. The stack trace of the fault looks like this: Program received signal SIGSEGV, Segmentation fault. 0x00007ffff6244500 in QList<PySide::MethodData>::detach() () from /usr/local/lib/libpyside-python2.6.so.1.0 (gdb) bt #0 0x00007ffff6244500 in QList<PySide::MethodData>::detach() () from /usr/local/lib/libpyside-python2.6.so.1.0 #1 0x00007ffff6243920 in QList<PySide::MethodData>::begin() () from /usr/local/lib/libpyside-python2.6.so.1.0 #2 0x00007ffff62416c8 in PySide::DynamicQMetaObject::addMethod(QMetaMethod::MethodType, char const*, char const*) () from /usr/local/lib/libpyside-python2.6.so.1.0 #3 0x00007ffff6241afd in PySide::DynamicQMetaObject::addSignal(char const*, char const*) () from /usr/local/lib/libpyside-python2.6.so.1.0 #4 0x00007ffff624750c in PySide::SignalManager::registerMetaMethod(QObject*, char const*, QMetaMethod::MethodType) () from /usr/local/lib/libpyside-python2.6.so.1.0 #5 0x00007ffff65bb780 in qobjectConnectCallback(QObject*, char const*, _object*, Qt::ConnectionType) () from /usr/local/lib/python2.6/dist-packages/PySide/QtCore.so #6 0x00007ffff65be160 in Sbk_QObjectFunc_connect () from /usr/local/lib/python2.6/dist-packages/PySide/QtCore.so #7 0x000000000041f0c7 in PyObject_Call () #8 0x00000000004a1b03 in PyEval_CallObjectWithKeywords () #9 0x00007ffff624c3ba in signalInstanceConnect () from /usr/local/lib/libpyside-python2.6.so.1.0 #10 0x00000000004a7c5e in PyEval_EvalFrameEx () #11 0x00000000004a9671 in PyEval_EvalCodeEx () #12 0x00000000004a9742 in PyEval_EvalCode () #13 0x00000000004c9a0e in PyRun_FileExFlags () #14 0x00000000004c9c24 in PyRun_SimpleFileExFlags () #15 0x000000000041a7ff in Py_Main () #16 0x00007ffff69d8c4d in __libc_start_main (main=<value optimised out>, argc=<value optimised out>, ubp_av=<value optimised out>, init=<value optimised out>, fini=<value optimised out>, rtld_fini=<value optimised out>, stack_end=0x7fffffffe3d8) at libc-start.c:226 #17 0x00000000004199f9 in _start () The full demonstration source code is at http://scintilla.org/rat.tgz . Most relevant source code: --- Rat.h ------------------------------------------------------------------ #ifndef RAT_H #define RAT_H #include <QtCore/QtCore> class Rat : public QObject { Q_OBJECT public: Rat(); virtual ~Rat(); void Possibly(bool tell); signals: void significate(); }; #endif // RAT_H --- typesystem_Rat.xml ------------------------------------------------------------------ <?xml version="1.0"?> <typesystem package="PyRat"> <load-typesystem name="typesystem_core.xml" generate="no" /> <object-type name="Rat" /> </typesystem> --- testRat.py ------------------------------------------------------------------ from PySide.QtCore import * from PyRat import * class C(QObject): def __init__(self): QObject.__init__(self) def rcv(self): print "rcv" rattus = Rat() c = C() rattus.Possibly(0) print dir(rattus.significate) rattus.significate.connect(c.rcv) print "1" rattus.Possibly(1) --------------------------------------------------------------------- Neil _______________________________________________ PySide mailing list [email protected] http://lists.pyside.org/listinfo/pyside
