Bug#319987: Segmentation fault in python: vte.Terminal.set_colors

Ethan Glasser-Camp glasse at rpi.edu
Tue Jul 26 03:57:11 UTC 2005


Package: python-vte
Version: 0.11.13-2

Attached is an example script that should set colors on a VTE Terminal widget to
be all white. It segfaults when run with the python-vte package.

I tracked the problem down to the python/vte.c file, in
_wrap_vte_terminal_set_colors(), line 472 or so:

    if (PySequence_Check(py_palette)) {
	palette_size = PySequence_Length(py_palette);
        palette = g_malloc(sizeof(GdkColor) * palette_size);
	for (i = 0; i < palette_size; i++) {
	    item = PySequence_GetItem(py_palette, i); /* INCREFs */
            if (!pyg_boxed_check(item, GDK_TYPE_COLOR)) {
		g_free(palette);
        	PyErr_SetString(PyExc_TypeError, "palette should be a list of GdkColors");
		return NULL;
	    }
	    /*           Good here              */
	    palette[i] = *((GdkColor*)pyg_boxed_get(py_palette, GdkColor));
	    /*      Never get here -- ^^^^^ segfaults!!       */
	    printf("about to dec\n");
            Py_DECREF(item);
	    printf("decremented successfully\n");
	}
    }

I think py_palette in this line should be changed to item. I haven't done any
strenuous testing, but this appears to make the program not seg fault.

Ethan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: use_vte.py
Type: text/x-python
Size: 258 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-gnome-maintainers/attachments/20050725/0e71e6be/use_vte-0001.py


More information about the Pkg-gnome-maintainers mailing list