PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 197 - QObject.emit segfaults when signal has unregistered type.
: QObject.emit segfaults when signal has unregistered type.
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: Shiboken
: HEAD
: All All
: P5 normal
Assigned To: Marcelo Lira
:
:
:
  Show dependency treegraph
 
Reported: 2010-03-26 16:25 EET by Bruno Araujo
Modified: 2010-05-04 18:43 EEST (History)
7 users (show)

See Also:


Attachments
Test case for the segfault (181 bytes, text/x-python)
2010-03-26 17:22 EET, Lauro Moura
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bruno Araujo 2010-03-26 16:25:32 EET
When you click the Sign in button on the new Twitter account dialog
(Accounts/New/Twitter), the program breaks down; the gdb trace is below. Even
if it is a problem with Twcano implementation and not with Shiboken a exception
should be thrown instead, not a SIGSEGV.

[static Shiboken::TypeResolver* Shiboken::TypeResolver::get(const char*)] Can't
find type resolver for PyObject

Program received signal SIGSEGV, Segmentation fault.
0x00f21fcb in Shiboken::TypeResolver::toCpp (this=0x0, pyObj=0x873ea2c) at
shiboken/libshiboken/typeresolver.cpp:114
114        return m_d->pythonToCpp(pyObj);
Current language:  auto
The current source language is "auto; currently c++".
(gdb) back
#0  0x00f21fcb in Shiboken::TypeResolver::toCpp (this=0x0, pyObj=0x873ea2c) at
shiboken/libshiboken/typeresolver.cpp:114
#1  0x00cbdbc0 in emitNormalSignal (source=0x8837638, signalIndex=36,
signal=0x873b575 "enableAccount(PyObject)", args=0x853c22c, argTypes=...)
    at pyside-shiboken/libpyside/signalmanager.cpp:228
#2  0x00cbdda3 in PySide::SignalManager::emitSignal (this=0xcc9298,
source=0x8837638, signal=0x873b575 "enableAccount(PyObject)", args=0x853c22c)
    at pyside-shiboken/libpyside/signalmanager.cpp:250
#3  0x0226e18d in SbkQObjectFunc_emit (self=0x873b53c, args=0xb7f9290c)
    at
pyside-shiboken/build/PySide/QtCore/PySide/QtCore/qobject_wrapper.cpp:924
#4  0x080dc0d0 in call_function (f=0x89b423c, throwflag=0) at
../Python/ceval.c:3706
#5  PyEval_EvalFrameEx (f=0x89b423c, throwflag=0) at ../Python/ceval.c:2389
#6  0x080dd384 in fast_function (f=0x8876044, throwflag=0) at
../Python/ceval.c:3792
#7  call_function (f=0x8876044, throwflag=0) at ../Python/ceval.c:3727
#8  PyEval_EvalFrameEx (f=0x8876044, throwflag=0) at ../Python/ceval.c:2389
#9  0x080dddf2 in PyEval_EvalCodeEx (co=0x8731578, globals=0x8728bdc,
locals=0x0, args=0xb7f92578, argcount=2, kws=0x0, kwcount=0, defs=0x0,
defcount=0, 
    closure=0x0) at ../Python/ceval.c:2968
#10 0x0816014c in function_call (func=0x87398b4, arg=0xb7f9256c, kw=0x0) at
../Objects/funcobject.c:524
#11 0x0806120a in PyObject_Call (func=0x87398b4, arg=0xb7f9256c, kw=0x0) at
../Objects/abstract.c:2492
#12 0x080684ac in instancemethod_call (func=0x86b2d4c, arg=0xb7f9256c, kw=0x0)
at ../Objects/classobject.c:2579
#13 0x0806120a in PyObject_Call (func=0x86b2d4c, arg=0xb7fd846c, kw=0x0) at
../Objects/abstract.c:2492
#14 0x080d6ef2 in PyEval_CallObjectWithKeywords (func=0x86b2d4c,
arg=0xb7fd846c, kw=0x0) at ../Python/ceval.c:3575
#15 0x080612a0 in PyObject_CallObject (o=0x86b2d4c, a=0xb7fd846c) at
../Objects/abstract.c:2480
#16 0x00cbe0f1 in PySide::SignalManager::qt_metacall (object=0x8837638,
call=QMetaObject::InvokeMetaMethod, id=86, args=0xbfffc5ac)
    at pyside-shiboken/libpyside/signalmanager.cpp:286
#17 0x004cedef in QDialogWrapper::qt_metacall (this=0x8837638,
call=QMetaObject::InvokeMetaMethod, id=86, args=0xbfffc5ac)
    at pyside-shiboken/build/PySide/QtGui/PySide/QtGui/qdialog_wrapper.cpp:926
#18 0x01b9fadb in QMetaObject::metacall (object=0x2cc340,
cl=QMetaObject::InvokeMetaMethod, idx=86, argv=0xbfffc5ac)
    at /var/tmp/qt-src/src/corelib/kernel/qmetaobject.cpp:237
#19 0x01bad5a7 in QMetaObject::activate (sender=0x8825e80, m=0x19f5444,
local_signal_index=0, argv=0x0)
    at /var/tmp/qt-src/src/corelib/kernel/qobject.cpp:3285
#20 0x014fcea3 in QDialogButtonBox::clicked (this=0x8825e80, _t1=0x8838920) at
.moc/release-shared/moc_qdialogbuttonbox.cpp:165
#21 0x014fd8bc in QDialogButtonBoxPrivate::_q_handleButtonClicked
(this=0x8843eb8) at /var/tmp/qt-src/src/gui/widgets/qdialogbuttonbox.cpp:1129
#22 0x014ff383 in QDialogButtonBox::qt_metacall (this=0x8825e80,
_c=QMetaObject::InvokeMetaMethod, _id=4, _a=0xbfffc6fc)
    at .moc/release-shared/moc_qdialogbuttonbox.cpp:121
#23 0x004c6a6e in QDialogButtonBoxWrapper::qt_metacall (this=0x8825e80,
call=QMetaObject::InvokeMetaMethod, id=31, args=0xbfffc6fc)
    at
pyside-shiboken/build/PySide/QtGui/PySide/QtGui/qdialogbuttonbox_wrapper.cpp:898
#24 0x01b9fadb in QMetaObject::metacall (object=0x2cc340,
cl=QMetaObject::InvokeMetaMethod, idx=31, argv=0xbfffc6fc)
    at /var/tmp/qt-src/src/corelib/kernel/qmetaobject.cpp:237
#25 0x01bad5a7 in QMetaObject::activate (sender=0x8838920, m=0x1a02a64,
local_signal_index=2, argv=0x0)
    at /var/tmp/qt-src/src/corelib/kernel/qobject.cpp:3285
#26 0x017eca69 in QAbstractButton::clicked (this=0x8838920, _t1=false) at
/var/tmp/qt-src/src/gui/.moc/release-shared/moc_qabstractbutton.cpp:206
#27 0x014c65a9 in QAbstractButtonPrivate::emitClicked (this=0x8870380) at
/var/tmp/qt-src/src/gui/widgets/qabstractbutton.cpp:546
#28 0x014c7b20 in QAbstractButtonPrivate::click (this=0x8870380) at
/var/tmp/qt-src/src/gui/widgets/qabstractbutton.cpp:539
#29 0x014c7d91 in QAbstractButton::mouseReleaseEvent (this=0x8838920,
e=0xbfffcf6c) at /var/tmp/qt-src/src/gui/widgets/qabstractbutton.cpp:1121
#30 0x0076489d in QPushButtonWrapper::mouseReleaseEvent (this=0x8838920,
e=0xbfffcf6c)
    at
pyside-shiboken/build/PySide/QtGui/PySide/QtGui/qpushbutton_wrapper.cpp:729
#31 0x010f139a in QWidget::event (this=0x8838920, event=0xbfffcf6c) at
/var/tmp/qt-src/src/gui/kernel/qwidget.cpp:7998
#32 0x014c7003 in QAbstractButton::event (this=0x8838920, e=0xbfffcf6c) at
/var/tmp/qt-src/src/gui/widgets/qabstractbutton.cpp:1080
#33 0x01574038 in QPushButton::event (this=0x8838920, e=0xbfffcf6c) at
/var/tmp/qt-src/src/gui/widgets/qpushbutton.cpp:679
#34 0x0076280b in QPushButtonWrapper::event (this=0x8838920, e=0xbfffcf6c)
    at
pyside-shiboken/build/PySide/QtGui/PySide/QtGui/qpushbutton_wrapper.cpp:339
#35 0x0108dbcf in QApplicationPrivate::notify_helper (this=0x8768d08,
receiver=0x8838920, e=0xbfffcf6c)
    at /var/tmp/qt-src/src/gui/kernel/qapplication.cpp:4300
#36 0x01091b6c in QApplication::notify (this=0x8769280, receiver=0x8838920,
e=0xbfffcf6c) at /var/tmp/qt-src/src/gui/kernel/qapplication.cpp:3865
#37 0x01b9950b in QCoreApplication::notifyInternal (this=0x8769280,
receiver=0x8838920, event=0xbfffcf6c)
    at /var/tmp/qt-src/src/corelib/kernel/qcoreapplication.cpp:704
---Type <return> to continue, or q <return> to quit---
#38 0x01090f09 in QCoreApplication::sendEvent (receiver=0x8838920,
event=0xbfffcf6c, alienWidget=0x8838920, nativeWidget=0x8837638,
buttonDown=0x1a11578, 
    lastMouseReceiver=..., spontaneous=true) at
../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#39 QApplicationPrivate::sendMouseEvent (receiver=0x8838920, event=0xbfffcf6c,
alienWidget=0x8838920, nativeWidget=0x8837638, buttonDown=0x1a11578, 
    lastMouseReceiver=..., spontaneous=true) at
/var/tmp/qt-src/src/gui/kernel/qapplication.cpp:2965
#40 0x0111d8b7 in QETWidget::translateMouseEvent (this=0x8837638,
event=0xbfffd498) at /var/tmp/qt-src/src/gui/kernel/qapplication_x11.cpp:4368
#41 0x0111cddc in QApplication::x11ProcessEvent (this=0x8769280,
event=0xbfffd498) at /var/tmp/qt-src/src/gui/kernel/qapplication_x11.cpp:3379
#42 0x0114859b in x11EventSourceDispatch (s=0x8781440, callback=0,
user_data=0x0) at
/var/tmp/qt-src/src/gui/kernel/qguieventdispatcher_glib.cpp:146
#43 0x01e13e88 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#44 0x01e17730 in ?? () from /lib/libglib-2.0.so.0
#45 0x01e17863 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#46 0x01bc6e38 in QEventDispatcherGlib::processEvents (this=0x877e338,
flags=...) at /var/tmp/qt-src/src/corelib/kernel/qeventdispatcher_glib.cpp:412
#47 0x01148375 in QGuiEventDispatcherGlib::processEvents (this=0x877e338,
flags=...) at /var/tmp/qt-src/src/gui/kernel/qguieventdispatcher_glib.cpp:204
#48 0x01b985dd in QEventLoop::processEvents (this=0xbfffd7ac, flags=...) at
/var/tmp/qt-src/src/corelib/kernel/qeventloop.cpp:149
#49 0x01b9896d in QEventLoop::exec (this=0xbfffd7ac, flags=...) at
/var/tmp/qt-src/src/corelib/kernel/qeventloop.cpp:201
#50 0x015fd029 in QDialog::exec (this=0x8837638) at
/var/tmp/qt-src/src/gui/dialogs/qdialog.cpp:546
#51 0x004cf9a2 in SbkQDialogFunc_exec_ (self=0x873b53c)
    at pyside-shiboken/build/PySide/QtGui/PySide/QtGui/qdialog_wrapper.cpp:1165
#52 0x080dbfd5 in call_function (f=0x884bb14, throwflag=0) at
../Python/ceval.c:3690
#53 PyEval_EvalFrameEx (f=0x884bb14, throwflag=0) at ../Python/ceval.c:2389
#54 0x080dddf2 in PyEval_EvalCodeEx (co=0xb7f8a7b8, globals=0x853d24c,
locals=0x0, args=0xb7fd8578, argcount=1, kws=0x0, kwcount=0, defs=0x0,
defcount=0, 
    closure=0x0) at ../Python/ceval.c:2968
#55 0x0816014c in function_call (func=0x8739f44, arg=0xb7fd856c, kw=0x0) at
../Objects/funcobject.c:524
#56 0x0806120a in PyObject_Call (func=0x8739f44, arg=0xb7fd856c, kw=0x0) at
../Objects/abstract.c:2492
#57 0x080684ac in instancemethod_call (func=0x86b2d24, arg=0xb7fd856c, kw=0x0)
at ../Objects/classobject.c:2579
#58 0x0806120a in PyObject_Call (func=0x86b2d24, arg=0xb7f9e02c, kw=0x0) at
../Objects/abstract.c:2492
#59 0x080d6ef2 in PyEval_CallObjectWithKeywords (func=0x86b2d24,
arg=0xb7f9e02c, kw=0x0) at ../Python/ceval.c:3575
#60 0x080612a0 in PyObject_CallObject (o=0x86b2d24, a=0xb7f9e02c) at
../Objects/abstract.c:2480
#61 0x00cbe0f1 in PySide::SignalManager::qt_metacall (object=0x87e3a10,
call=QMetaObject::InvokeMetaMethod, id=81, args=0xbfffde5c)
    at pyside-shiboken/libpyside/signalmanager.cpp:286
#62 0x006a2ee7 in QMainWindowWrapper::qt_metacall (this=0x87e3a10,
call=QMetaObject::InvokeMetaMethod, id=81, args=0xbfffde5c)
    at
pyside-shiboken/build/PySide/QtGui/PySide/QtGui/qmainwindow_wrapper.cpp:922
#63 0x01b9fadb in QMetaObject::metacall (object=0x2cc340,
cl=QMetaObject::InvokeMetaMethod, idx=81, argv=0xbfffde5c)
    at /var/tmp/qt-src/src/corelib/kernel/qmetaobject.cpp:237
#64 0x01bad5a7 in QMetaObject::activate (sender=0x87f0aa8, m=0x19f0178,
local_signal_index=1, argv=0x0)
    at /var/tmp/qt-src/src/corelib/kernel/qobject.cpp:3285
#65 0x01086409 in QAction::triggered (this=0x87f0aa8, _t1=false) at
.moc/release-shared/moc_qaction.cpp:263
#66 0x01087acf in QAction::activate (this=0x87f0aa8, event=QAction::Trigger) at
/var/tmp/qt-src/src/gui/kernel/qaction.cpp:1255
#67 0x0156acbf in QMenuBarPrivate::activateAction (this=0x87f02b0,
action=0x87f0aa8, action_e=QAction::Trigger)
    at /var/tmp/qt-src/src/gui/widgets/qmenubar.cpp:512
#68 0x01570ddc in QMenuBar::mouseReleaseEvent (this=0x87e2a70, e=0xbfffe6bc) at
/var/tmp/qt-src/src/gui/widgets/qmenubar.cpp:1133
#69 0x006bee1b in QMenuBarWrapper::mouseReleaseEvent (this=0x87e2a70,
arg__1=0xbfffe6bc)
    at pyside-shiboken/build/PySide/QtGui/PySide/QtGui/qmenubar_wrapper.cpp:679
#70 0x010f139a in QWidget::event (this=0x87e2a70, event=0xbfffe6bc) at
/var/tmp/qt-src/src/gui/kernel/qwidget.cpp:7998
#71 0x01570a1a in QMenuBar::event (this=0x87e2a70, e=0xbfffe6bc) at
/var/tmp/qt-src/src/gui/widgets/qmenubar.cpp:1524
#72 0x006bcf75 in QMenuBarWrapper::event (this=0x87e2a70, arg__1=0xbfffe6bc)
    at pyside-shiboken/build/PySide/QtGui/PySide/QtGui/qmenubar_wrapper.cpp:317
#73 0x0108dbcf in QApplicationPrivate::notify_helper (this=0x8768d08,
receiver=0x87e2a70, e=0xbfffe6bc)
    at /var/tmp/qt-src/src/gui/kernel/qapplication.cpp:4300
#74 0x01091b6c in QApplication::notify (this=0x8769280, receiver=0x87e2a70,
e=0xbfffe6bc) at /var/tmp/qt-src/src/gui/kernel/qapplication.cpp:3865
#75 0x01b9950b in QCoreApplication::notifyInternal (this=0x8769280,
receiver=0x87e2a70, event=0xbfffe6bc)
    at /var/tmp/qt-src/src/corelib/kernel/qcoreapplication.cpp:704
#76 0x01090f09 in QCoreApplication::sendEvent (receiver=0x87e2a70,
event=0xbfffe6bc, alienWidget=0x87e2a70, nativeWidget=0x87e3a10,
buttonDown=0x1a11578, 
    lastMouseReceiver=..., spontaneous=true) at
../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#77 QApplicationPrivate::sendMouseEvent (receiver=0x87e2a70, event=0xbfffe6bc,
alienWidget=0x87e2a70, nativeWidget=0x87e3a10, buttonDown=0x1a11578, 
---Type <return> to continue, or q <return> to quit---
    lastMouseReceiver=..., spontaneous=true) at
/var/tmp/qt-src/src/gui/kernel/qapplication.cpp:2965
#78 0x0111d8b7 in QETWidget::translateMouseEvent (this=0x87e3a10,
event=0xbfffebe8) at /var/tmp/qt-src/src/gui/kernel/qapplication_x11.cpp:4368
#79 0x0111cddc in QApplication::x11ProcessEvent (this=0x8769280,
event=0xbfffebe8) at /var/tmp/qt-src/src/gui/kernel/qapplication_x11.cpp:3379
#80 0x0114859b in x11EventSourceDispatch (s=0x8781440, callback=0,
user_data=0x0) at
/var/tmp/qt-src/src/gui/kernel/qguieventdispatcher_glib.cpp:146
#81 0x01e13e88 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#82 0x01e17730 in ?? () from /lib/libglib-2.0.so.0
#83 0x01e17863 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#84 0x01bc6e38 in QEventDispatcherGlib::processEvents (this=0x877e338,
flags=...) at /var/tmp/qt-src/src/corelib/kernel/qeventdispatcher_glib.cpp:412
#85 0x01148375 in QGuiEventDispatcherGlib::processEvents (this=0x877e338,
flags=...) at /var/tmp/qt-src/src/gui/kernel/qguieventdispatcher_glib.cpp:204
#86 0x01b985dd in QEventLoop::processEvents (this=0xbfffeef0, flags=...) at
/var/tmp/qt-src/src/corelib/kernel/qeventloop.cpp:149
#87 0x01b9896d in QEventLoop::exec (this=0xbfffeef0, flags=...) at
/var/tmp/qt-src/src/corelib/kernel/qeventloop.cpp:201
#88 0x01b9a7ac in QCoreApplication::exec () at
/var/tmp/qt-src/src/corelib/kernel/qcoreapplication.cpp:981
#89 0x0108d367 in QApplication::exec () at
/var/tmp/qt-src/src/gui/kernel/qapplication.cpp:3579
#90 0x0043ad31 in SbkQApplicationFunc_exec_ (self=0x0)
    at
pyside-shiboken/build/PySide/QtGui/PySide/QtGui/qapplication_wrapper.cpp:716
#91 0x080dbfd5 in call_function (f=0x85fb0c4, throwflag=0) at
../Python/ceval.c:3690
#92 PyEval_EvalFrameEx (f=0x85fb0c4, throwflag=0) at ../Python/ceval.c:2389
#93 0x080dd384 in fast_function (f=0x82da3a4, throwflag=0) at
../Python/ceval.c:3792
#94 call_function (f=0x82da3a4, throwflag=0) at ../Python/ceval.c:3727
#95 PyEval_EvalFrameEx (f=0x82da3a4, throwflag=0) at ../Python/ceval.c:2389
#96 0x080dddf2 in PyEval_EvalCodeEx (co=0xb7fd5698, globals=0xb7fd01c4,
locals=0xb7fd01c4, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0,
defcount=0, 
    closure=0x0) at ../Python/ceval.c:2968
#97 0x080ddef7 in PyEval_EvalCode (co=0xb7fd5698, globals=0xb7fd01c4,
locals=0xb7fd01c4) at ../Python/ceval.c:522
#98 0x080faa1f in run_mod (fp=0x8293e98, filename=0xbffff5de "bin/twcano",
start=257, globals=0xb7fd01c4, locals=0xb7fd01c4, closeit=1, flags=0xbffff36c)
    at ../Python/pythonrun.c:1335
#99 PyRun_FileExFlags (fp=0x8293e98, filename=0xbffff5de "bin/twcano",
start=257, globals=0xb7fd01c4, locals=0xb7fd01c4, closeit=1, flags=0xbffff36c)
    at ../Python/pythonrun.c:1321
#100 0x080fac12 in PyRun_SimpleFileExFlags (fp=0x8293e98, filename=0xbffff5de
"bin/twcano", closeit=1, flags=0xbffff36c) at ../Python/pythonrun.c:931
#101 0x0805c8d8 in Py_Main (argc=2, argv=0xbffff454) at ../Modules/main.c:599
#102 0x0805baeb in main (argc=2, argv=0xbffff454) at ../Modules/python.c:23
Comment 1 Bruno Araujo 2010-03-26 17:07:54 EET
The line that triggers the segfault is below, as identified by the trace
module:

accountwindow.py(173):         self.emit(SIGNAL("enableAccount(PyObject)"),
acc)
Comment 2 Lauro Moura 2010-03-26 17:22:28 EET
Created attachment 38 [details]
Test case for the segfault

Connect line:
mainwindow.py
134:        w.connect(SIGNAL("enableAccount(PyObject)"), self._messager.login)

Emit line:
accountwindow.py
173:        self.emit(SIGNAL("enableAccount(PyObject)"), acc)

The signal signature should be just enableAccount, as it's a short circuit
signal.

But I think this bug should be kept as emit segfaults when an unknown type is
passed in the signature.
Comment 3 Hugo Parente Lima 2010-04-12 18:43:21 EEST
Fixed in commit pyside-shiboken/27458bcd2f87e29dbdb60ba0de463261fedd3afa

Now an exception is raised:

Traceback (most recent call last):                                              
  File "test.py", line 8, in <module>                                           
    a.emit(SIGNAL('foobar(Dummy)'), 22)                                         
TypeError: Unknown type used to emit a signal: Dummy                            

Also some reference leaks were fixed.