Bug#580791: python-gobject: glib.main_context_default() causes immediate segfault

Mark Wooding mdw at distorted.org.uk
Sat May 8 16:12:12 UTC 2010


Package: python-gobject
Version: 2.21.1-1
Severity: normal

[crybaby /tmp/mdw]cat break.py
import glib
print glib.main_context_default()
[crybaby /tmp/mdw]python break.py
Segmentation fault

What's going on?  glib/pyglib.c seems to be somewhat confused about how
it's getting hold of its type objects.  Rather than just using the handy
PyGMainContext_Type structure lying around, it says

static PyTypeObject *_PyGMainContext_Type;
#define PyGMainContext_Type (*_PyGMainContext_Type)

and relies on pyglib_init() saying

    _PyGMainContext_Type = (PyTypeObject*)PyObject_GetAttrString(glib, "MainContext");

to initialize this -- but /doesn't call pyglib_init() anywhere/.  Now,
when pyglib_main_context_new says

    self = (PyGMainContext *)PyObject_NEW(PyGMainContext,
                                          &PyGMainContext_Type);


it's using the macro, which indirects through _PyGMainContext_Type,
which is still a null pointer.  Result: segfault.

Workaround: import gobject, which calls pyglib_init() and sets the
pointer up.

Proper fix: either initialize the pointers properly, or at least put
pyglib_main_context_new in a different source file.

This bug is also in Ubuntu Lucid and Maemo Fremantle.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.31.9 (PREEMPT)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages python-gobject depends on:
ii  libc6                         2.10.2-6   Embedded GNU C Library: Shared lib
ii  libffi5                       3.0.9-2    Foreign Function Interface library
ii  libglib2.0-0                  2.24.0-1   The GLib library of C routines
ii  python                        2.5.4-9    An interactive high-level object-o
ii  python-support                1.0.8      automated rebuilding support for P
ii  python2.5                     2.5.5-6    An interactive high-level object-o

python-gobject recommends no packages.

Versions of packages python-gobject suggests:
pn  python-gobject-dbg            <none>     (no description available)

-- no debconf information






More information about the pkg-gnome-maintainers mailing list