Comment 63 for bug 146946

Revision history for this message
Dimitry Andric (dimitry-andric) wrote :

I'm having precisely the same problem as BruceBeare, and almost exactly
the same backtrace. :)

I downloaded the debug symbols, and this is what I got:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f1966f937a0 (LWP 19394)]
set_touchpad_enabled (state=<value optimized out>) at gsd-mouse-manager.c:420
420 gsd-mouse-manager.c: No such file or directory.
 in gsd-mouse-manager.c
(gdb) bt
#0 set_touchpad_enabled (state=<value optimized out>) at gsd-mouse-manager.c:420
#1 0x00007f195a26a8cd in gsd_mouse_manager_start (manager=0x660af0, error=<value optimized out>) at gsd-mouse-manager.c:836
#2 0x00007f195a2697f7 in impl_activate (plugin=0x660ac0) at gsd-mouse-plugin.c:78
#3 0x0000000000404f0c in gnome_settings_plugin_info_activate ()
#4 0x0000000000403c85 in ?? ()
#5 0x00007f1962928e0d in g_slist_foreach () from /usr/lib/libglib-2.0.so.0
#6 0x0000000000403e94 in gnome_settings_manager_start ()
#7 0x0000000000403ad8 in main ()
(gdb) print devicelist
$1 = (XDeviceInfo *) 0x0
(gdb) print numdevices
$2 = 32537

In my case, I'm running a GNOME session under VNC server, which does NOT
support the XInputExtension. However, the set_touchpad_enabled()
function in plugins/mouse/gsd-mouse-manager.c (which was introduced by
debian/patches/08_extra_touchpad_options.patch) uses XListInputDevices()
to get a list anyway:

static int
set_touchpad_enabled (gboolean state)
{
        int numdevices, i;
        int values[2];
        XDeviceInfo *devicelist = XListInputDevices (GDK_DISPLAY(), &numdevices);
 [...]
        for (i = 0; i < numdevices; i++) {
                if (strcmp (devicelist[i].name, "Synaptics Touchpad") == 0) {

The problem, as you can see in the gdb conversation above, is that if
devicelist is NULL, numdevices is *not* set to zero by the call to
XListInputDevices. Later on, the for loop will segfault in the first
strcmp() call.

I've attached a patch which fixes at least this particular problem.