[pygtk] Apparent PyGTK Segmentation Fault

Casey McGinty casey.mcginty at gmail.com
Thu Aug 21 17:13:32 WST 2008

I've come across a strange segmentation fault in PyGTK. Some other
interesting debug notes:

1) The failure occurs when I click on a button widget that calls a
gtk.Menu.popup() function.
2) I notice the failure only when I connect to the gtk.Menu 'deactivate'
3) The failure only occurs on a 2nd or later run of the program after a
PyGTK code change. The 1st time the program runs, all is fine. So, "code
change", "run", "click button", all works fine. Then "exit", "run", "click
button" .... failure.
4) When I run only the PyGTK portion of my program, the bug can not be
reproduced. Even when connected to the 'deactivate' signal.
5) I have verified this behavior on two different systems.

I am open to any debug suggestions or possible solutions. I am working on
building SVN versions of PyGTK and PyGObject. Is there any document on how
to quickly setup an environment to debug PyGTK?

Here is a back trace of the failure.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7e1f8c0 (LWP 14598)]
0xb7a23b80 in ?? () from
(gdb) bt
#0  0xb7a23b80 in ?? ()
   from /var/lib/python-support/python2.5/gtk-2.0/gtk/_gtk.so
#1  0x080c9ab3 in PyEval_EvalFrameEx (f=0x859b9dc, throwflag=0)
    at ../Python/ceval.c:3573
#2  0x080cb1f7 in PyEval_EvalCodeEx (co=0xb6e37770, globals=0xb6d4035c,
    locals=0x0, args=0xb7da4a38, argcount=4, kws=0x0, kwcount=0, defs=0x0,
    defcount=0, closure=0x0) at ../Python/ceval.c:2836
#3  0x0811372e in function_call (func=0xb6d3fb1c, arg=0xb7da4a2c, kw=0x0)
    at ../Objects/funcobject.c:517
#4  0x0805cb97 in PyObject_Call (func=0x8145720, arg=0xb7da4a2c, kw=0x0)
    at ../Objects/abstract.c:1861
#5  0x08062bfb in instancemethod_call (func=0xb6d3fb1c, arg=0xb7da4a2c,
    at ../Objects/classobject.c:2519
#6  0x0805cb97 in PyObject_Call (func=0x8145720, arg=0xb6d477ac, kw=0x0)
    at ../Objects/abstract.c:1861
#7  0x080c2e9c in PyEval_CallObjectWithKeywords (func=0xb7dd3374,
    arg=0xb6d477ac, kw=0x0) at ../Python/ceval.c:3442
#8  0x0805d040 in PyObject_CallObject (o=0xb7dd3374, a=0xb6d477ac)
    at ../Objects/abstract.c:1852
#9  0xb7b28afb in ?? ()
   from /var/lib/python-support/python2.5/gtk-2.0/gobject/_gobject.so
#10 0xb7b7c759 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#11 0xb7b90f8b in ?? () from /usr/lib/libgobject-2.0.so.0
#12 0xb7b92947 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#13 0xb7b92f69 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#14 0xb781a667 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#15 0xb76f4b21 in gtk_propagate_event () from /usr/lib/libgtk-x11-2.0.so.0
#16 0xb76f5e92 in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0
#17 0xb756ea9a in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#18 0xb7c45dd6 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#19 0xb7c49193 in ?? () from /usr/lib/libglib-2.0.so.0
#20 0xb7c49577 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#21 0xb76f6264 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#22 0xb7a75ee0 in ?? ()
   from /var/lib/python-support/python2.5/gtk-2.0/gtk/_gtk.so
#23 0x080ca5c6 in PyEval_EvalFrameEx (f=0x82f2854, throwflag=0)
    at ../Python/ceval.c:3557
#24 0x080c96e5 in PyEval_EvalFrameEx (f=0x81c2964, throwflag=0)
    at ../Python/ceval.c:3659
#25 0x080cb1f7 in PyEval_EvalCodeEx (co=0xb7da7410, globals=0xb7df8acc,
    locals=0xb7df8acc, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0,
    defcount=0, closure=0x0) at ../Python/ceval.c:2836
#26 0x080cb347 in PyEval_EvalCode (co=0xb7da7410, globals=0xb7df8acc,
    locals=0xb7df8acc) at ../Python/ceval.c:494
#27 0x080ea818 in PyRun_FileExFlags (fp=0x816b008,
    filename=0xbf83b741 "scripts/riproar", start=257, globals=0xb7df8acc,
    locals=0xb7df8acc, closeit=1, flags=0xbf839548)
    at ../Python/pythonrun.c:1273
#28 0x080eaab9 in PyRun_SimpleFileExFlags (fp=0x816b008,
    filename=0xbf83b741 "scripts/riproar", closeit=1, flags=0xbf839548)
    at ../Python/pythonrun.c:879
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20080820/a60fcce4/attachment.htm 

More information about the pygtk mailing list