PyGtk App Core dumps

Bug #638513 reported by Rick Spencer on 2010-09-14
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
glib2.0 (Ubuntu)
Medium
Unassigned

Bug Description

Steps:
1. expand the attached crash_repro directory that has the repro code
2. run the "grid_filter.py" file
(note that if you have quickly-widgets installed, you need to make sure that you point your python path to the directory that contains the code.
3. In the filter UI at the top, set ID < 5 (or whatever)

Result:
A couple of warnings are displayed, and then a crash
rick@rick-desktop:~/Projects/crash_repro$ PYTHONPATH="./" python grid_filter.py TypeError: can't convert return value to desired type
grid_filter.py:797: Warning: /build/buildd/glib2.0-2.25.15/gobject/gtype.c:4181: type id `0' is invalid
  gtk.main()
grid_filter.py:797: Warning: can't peek value table for type `<invalid>' which is not currently referenced
  gtk.main()
Segmentation fault (core dumped)

Expected:
The Grid is filtered properly

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: libglib2.0-0 2.25.15-0ubuntu2
ProcVersionSignature: Ubuntu 2.6.35-20.29-generic 2.6.35.4
Uname: Linux 2.6.35-20-generic i686
Architecture: i386
Date: Tue Sep 14 14:57:05 2010
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release i386 (20091028.5)
ProcEnviron:
 LANG=en_US.utf8
 SHELL=/bin/bash
SourcePackage: glib2.0

description: updated
Changed in glib2.0 (Ubuntu):
assignee: nobody → Barry Warsaw (barry)
Krzysztof Klimonda (kklimonda) wrote :

A smaller python script that reproduces this crash

Krzysztof Klimonda (kklimonda) wrote :

The crash is result of callback not returning expected value (or, as in our examples not returning nothing at all). Python should still handle it more gracefully.

Barry Warsaw (barry) on 2010-09-23
Changed in glib2.0 (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
Barry Warsaw (barry) wrote :
Download full text (7.2 KiB)

(gdb) bt
#0 0x00007ffff60d1953 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#1 0x00007ffff60d2353 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#2 0x00007ffff492380c in gtk_spin_button_update () from /usr/lib/libgtk-x11-2.0.so.0
#3 0x00007ffff4926008 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#4 0x00007ffff48a86e3 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#5 0x00007ffff60b7afe in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#6 0x00007ffff60cffc2 in ?? () from /usr/lib/libgobject-2.0.so.0
#7 0x00007ffff60d193c in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#8 0x00007ffff60d2353 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#9 0x00007ffff49dbc0f in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#10 0x00007ffff489f3b3 in gtk_propagate_event () from /usr/lib/libgtk-x11-2.0.so.0
#11 0x00007ffff48a058b in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0
#12 0x00007ffff44fae9c in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#13 0x00007ffff59fb7e2 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#14 0x00007ffff59ff748 in ?? () from /lib/libglib-2.0.so.0
#15 0x00007ffff59ffc55 in g_main_loop_run () from /lib/libglib-2.0.so.0
#16 0x00007ffff48a0a47 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#17 0x00007ffff5046268 in _wrap_gtk_main (self=0x0) at /build/buildd/pygtk-2.21.0/gtk/gtk.override:1239
#18 0x00000000004cf3c8 in call_function (pp_stack=0x7fffffffddd0, oparg=0) at ../Python/ceval.c:3734
#19 0x00000000004ca734 in PyEval_EvalFrameEx (f=Frame 0x9cbeb0, for file spin.py, line 14, in <module> (), throwflag=0) at ../Python/ceval.c:2412
#20 0x00000000004cd04c in PyEval_EvalCodeEx (co=0x7ffff7ec3970, globals={'__warningregistry__': {("can't peek value table for type `<invalid>' which is not currently referenced", <type at remote 0x9ce0f0>, 14): True, ("/build/buildd/glib2.0-2.25.15/gobject/gtype.c:4181: type id `0' is invalid", <type at remote 0x9ce0f0>, 14): True}, '__builtins__': <module at remote 0x7ffff7fb5e30>, '__file__': 'spin.py', 'gtk': <module at remote 0x7ffff7e64bc0>, '__package__': None, 'window': <gtk.Window at remote 0xf3e160>, 'test': <function at remote 0x7ffff7ece990>, '__name__': '__main__', 'spin': <gtk.SpinButton at remote 0xf3e6e0>, '__doc__': None}, locals={'__warningregistry__': {("can't peek value table for type `<invalid>' which is not currently referenced", <type at remote 0x9ce0f0>, 14): True, ("/build/buildd/glib2.0-2.25.15/gobject/gtype.c:4181: type id `0' is invalid", <type at remote 0x9ce0f0>, 14): True}, '__builtins__': <module at remote 0x7ffff7fb5e30>, '__file__': 'spin.py', 'gtk': <module at remote 0x7ffff7e64bc0>, '__package__': None, 'window': <gtk.Window at remote 0xf3e160>, 'test': <function at remote 0x7ffff7ece990>, '__name__': '__main__', 'spin': <gtk.SpinButton at remote 0xf3e6e0>, '__doc__': None}, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at ../Python/ceval.c:3000
#21 0x00000000004c3ca6 in PyEval_EvalCode (co=0x7ffff7ec3970, globals={'__warningregistry__': {("can't peek value table for type `<invalid>' which is not currently referenced", <type at remote 0x9ce0f0>, 14): True, ("/build/buildd/glib2.0-2.25...

Read more...

ok, so you're not supposed to use "input" from Python ... according to the documentation:
The "input" signal is emitted when the value changes. The value_ptr is a GPointer to the value that cannot be accessed from PyGTK. This signal cannot be handled in PyGTK.

d'oh

Changed in glib2.0 (Ubuntu):
assignee: Barry Warsaw (barry) → nobody
status: Confirmed → Invalid

for future reference, 'value-changed' is the correct signal to use

Barry Warsaw (barry) wrote :

pygtk still shouldn't core dump the interpreter ;) but i guess this is a bug for upstream to fix. It should probably raise a ValueError on the .connect() call.

Tomeu Vizoso (tomeu) wrote :

What would mean that ValueError in connect?

The correct fix I guess is stop using the GObject API for discovering which signals a GObject subclass has and instead rely on the introspection API. Then we could mark as introspectable=0 all such signals and you would get a 'Signal not known' error on connect().

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers