[PyKDE] PyQt4 Menu Seg Fault

Andreas Pakulat apaku at gmx.de
Fri Jan 13 10:11:42 GMT 2006


On 13.01.06 09:20:28, Phil Thompson wrote:
> On Friday 13 January 2006 2:02 am, Doug Bell wrote:
> > Hi -
> >
> > Menus in PyQt4 work fine when a separate action is created and assigned
> > to a menu item, but there is a problem when defining the action within
> > an overloaded QMenu.addAction() method.  The menu gets created but then
> > gives a segmentation fault when the menu item is actuated.
> >
> > I've attached a short example that illustrates the problem.  The first
> > item in the context menu (from a separate QAction) works fine, but the
> > second one (using the internal action) causes a seg fault.
> >
> > I'm using the 20060111 snapshot.
> 
> It works fine for me - on amd64.

Hmm, I wonder if that might be a reason why the mdi-example works with
your machine but not with mine here.

> Anybody else see a problem?

Yes selecting the "Broken Action" gives me:

(gdb) bt
#0  0xb72008ac in ?? ()
   from /home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/QtGui.so
#1  0xb7f0e8cf in initsip ()
   from /home/andreas/python2.4/lib/python2.4/site-packages/sip.so
#2  0xb7f0ea21 in initsip ()
   from /home/andreas/python2.4/lib/python2.4/site-packages/sip.so
#3  0xb7911cef in ?? ()
   from /home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/QtCore.so
#4  0xb7911e5a in ?? ()
   from /home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/QtCore.so
#5  0xb785f391 in QMetaObject::activate ()
   from /home/andreas/qt4.1.0/lib/libQtCore.so.4
#6  0xb785f666 in QMetaObject::activate ()
   from /home/andreas/qt4.1.0/lib/libQtCore.so.4
#7  0xb6cef6ce in QAction::triggered () from /home/andreas/qt4.1.0/lib/libQtGui.so.4
#8  0xb6cf018a in QAction::activate () from /home/andreas/qt4.1.0/lib/libQtGui.so.4
#9  0xb6f59e28 in QMenu::wheelEvent () from /home/andreas/qt4.1.0/lib/libQtGui.so.4
#10 0xb6f5c59a in QMenu::mouseReleaseEvent ()
   from /home/andreas/qt4.1.0/lib/libQtGui.so.4
#11 0xb73a5f02 in initQtGui ()
   from /home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/QtGui.so
#12 0xb6d36843 in QWidget::event () from /home/andreas/qt4.1.0/lib/libQtGui.so.4
#13 0xb6f56e90 in QMenu::event () from /home/andreas/qt4.1.0/lib/libQtGui.so.4
#14 0xb73a6513 in initQtGui ()
   from /home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/QtGui.so
#15 0xb6cf450e in QApplicationPrivate::notify_helper ()
   from /home/andreas/qt4.1.0/lib/libQtGui.so.4
#16 0xb6cf58bc in QApplication::notify ()
   from /home/andreas/qt4.1.0/lib/libQtGui.so.4
#17 0xb74bf973 in initQtGui ()
   from /home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/QtGui.so
#18 0xb6d4a212 in QApplication::x11ProcessEvent ()
   from /home/andreas/qt4.1.0/lib/libQtGui.so.4
#19 0xb6d48fb2 in QApplication::x11ProcessEvent ()
   from /home/andreas/qt4.1.0/lib/libQtGui.so.4
#20 0xb6d5a4d6 in non-virtual thunk to QDesktopWidget::~QDesktopWidget() ()
   from /home/andreas/qt4.1.0/lib/libQtGui.so.4
#21 0xb78504b3 in QEventLoop::processEvents ()
   from /home/andreas/qt4.1.0/lib/libQtCore.so.4
#22 0xb785070e in QEventLoop::exec () from /home/andreas/qt4.1.0/lib/libQtCore.so.4
#23 0xb6f5a2aa in QMenu::exec () from /home/andreas/qt4.1.0/lib/libQtGui.so.4
#24 0xb73acc79 in initQtGui ()
   from /home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/QtGui.so
#25 0x08126ee3 in PyCFunction_Call (func=0xb6b5e6fc, arg=0xb6b5e734, kw=0x0)
    at Objects/methodobject.c:73
#26 0x080d23ce in call_function (pp_stack=0xbff2b0c0, oparg=1) at Python/ceval.c:3558
#27 0x080cdd72 in PyEval_EvalFrame (f=0x81b0964) at Python/ceval.c:2163
#28 0x080d020d in PyEval_EvalCodeEx (co=0xb7c36a78, globals=0xb7c79e94, locals=0x0,
    args=0xb7c4a2e8, argcount=2, kws=0x0, kwcount=0, defs=0x0, defcount=0,
    closure=0x0) at Python/ceval.c:2736
#29 0x081266c4 in function_call (func=0xb76898a4, arg=0xb7c4a2d4, kw=0x0)
    at Objects/funcobject.c:548
#30 0x0805da38 in PyObject_Call (func=0xb76898a4, arg=0xb7c4a2d4, kw=0x0)
    at Objects/abstract.c:1756
#31 0x08066424 in instancemethod_call (func=0xb76898a4, arg=0xb7c4a2d4, kw=0x0)
    at Objects/classobject.c:2447
#32 0x0805da38 in PyObject_Call (func=0xb7c77fb4, arg=0xb6b5e6c4, kw=0x0)
    at Objects/abstract.c:1756
#33 0x080d1c84 in PyEval_CallObjectWithKeywords (func=0xb7c77fb4, arg=0xb6b5e6c4,
    kw=0x0) at Python/ceval.c:3425
#34 0xb7f1019c in initsip ()
   from /home/andreas/python2.4/lib/python2.4/site-packages/sip.so
#35 0xb71f0751 in ?? ()
   from /home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/QtGui.so
#36 0xb7514b9c in initQtGui ()
   from /home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/QtGui.so
#37 0xb6d363c2 in QWidget::event () from /home/andreas/qt4.1.0/lib/libQtGui.so.4
#38 0xb75141c0 in initQtGui ()
   from /home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/QtGui.so
#39 0xb6cf450e in QApplicationPrivate::notify_helper ()
   from /home/andreas/qt4.1.0/lib/libQtGui.so.4
#40 0xb6cf5b95 in QApplication::notify ()
---Type <return> to continue, or q <return> to quit---
   from /home/andreas/qt4.1.0/lib/libQtGui.so.4
#41 0xb74bf973 in initQtGui ()
   from /home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/QtGui.so
#42 0xb6d49f64 in QApplication::x11ProcessEvent ()
   from /home/andreas/qt4.1.0/lib/libQtGui.so.4
#43 0xb6d48fb2 in QApplication::x11ProcessEvent ()
   from /home/andreas/qt4.1.0/lib/libQtGui.so.4
#44 0xb6d5a4d6 in non-virtual thunk to QDesktopWidget::~QDesktopWidget() ()
   from /home/andreas/qt4.1.0/lib/libQtGui.so.4
#45 0xb78504b3 in QEventLoop::processEvents ()
   from /home/andreas/qt4.1.0/lib/libQtCore.so.4
#46 0xb785070e in QEventLoop::exec () from /home/andreas/qt4.1.0/lib/libQtCore.so.4
#47 0xb7853223 in QCoreApplication::exec ()
   from /home/andreas/qt4.1.0/lib/libQtCore.so.4
#48 0xb6cf4239 in QApplication::exec () from /home/andreas/qt4.1.0/lib/libQtGui.so.4
#49 0xb74c337d in initQtGui ()
   from /home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/QtGui.so
#50 0x08126ee3 in PyCFunction_Call (func=0xb7665d54, arg=0xb7c59034, kw=0x0)
    at Objects/methodobject.c:73
#51 0x080d23ce in call_function (pp_stack=0xbff2c510, oparg=0) at Python/ceval.c:3558
#52 0x080cdd72 in PyEval_EvalFrame (f=0x817414c) at Python/ceval.c:2163
#53 0x080d020d in PyEval_EvalCodeEx (co=0xb7c36b28, globals=0xb7c79e94,
    locals=0xb7c79e94, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0,
    defcount=0, closure=0x0) at Python/ceval.c:2736
#54 0x080c649c in PyEval_EvalCode (co=0xb7c36b28, globals=0xb7c79e94,
    locals=0xb7c79e94) at Python/ceval.c:484
#55 0x080fad21 in run_node (n=0xb7c6f320, filename=0xbff2d717 "menutest.py",
    globals=0xb7c79e94, locals=0xb7c79e94, flags=0xbff2c870)
    at Python/pythonrun.c:1265
#56 0x080faccb in run_err_node (n=0xb7c6f320, filename=0xbff2d717 "menutest.py",
    globals=0xb7c79e94, locals=0xb7c79e94, flags=0xbff2c870)
    at Python/pythonrun.c:1252
#57 0x080fac9a in PyRun_FileExFlags (fp=0x8172008,
    filename=0xbff2d717 "menutest.py", start=257, globals=0xb7c79e94,
    locals=0xb7c79e94, closeit=1, flags=0xbff2c870) at Python/pythonrun.c:1243
#58 0x080f9925 in PyRun_SimpleFileExFlags (fp=0x8172008,
    filename=0xbff2d717 "menutest.py", closeit=1, flags=0xbff2c870)
    at Python/pythonrun.c:860
#59 0x080f9094 in PyRun_AnyFileExFlags (fp=0x8172008,
    filename=0xbff2d717 "menutest.py", closeit=1, flags=0xbff2c870)
    at Python/pythonrun.c:664
#60 0x08055f3c in Py_Main (argc=2, argv=0xbff2c974) at Modules/main.c:484
#61 0x08055372 in main (argc=2, argv=0xbff2c974) at Modules/python.c:23

Andreas

-- 
Blow it out your ear.




More information about the PyQt mailing list