annoying xorg crash due to librecord.so

Running with Unity on Ubuntu 11.10, I've had a few sporadic X crashes. This seems to be due to the librecord.so module and you end up with something like the following in the /var/log/Xorg.0.log:

Backtrace:
[224197.616] 0: /usr/bin/X (xorg_backtrace+0x37) [0x80a66f7]
[224197.616] 1: /usr/bin/X (0x8048000+0x62b3a) [0x80aab3a]
[224197.616] 2: (vdso) (__kernel_rt_sigreturn+0x0) [0x2c240c]
[224197.616] 3: /usr/lib/xorg/modules/extensions/librecord.so (0x145000+0x212f) [0x14712f]
[224197.617] 4: /usr/bin/X (_CallCallbacks+0x3c) [0x80769ec]
[224197.617] 5: /usr/bin/X (WriteToClient+0x273) [0x80a95a3]
[224197.617] 6: /usr/lib/xorg/modules/extensions/libdri2.so (ProcDRI2WaitMSCReply+0x70) [0xa38d70]
[224197.617] 7: /usr/lib/xorg/modules/extensions/libdri2.so (DRI2WaitMSCComplete+0x73) [0xa37003]
[224197.617] 8: /usr/lib/xorg/modules/drivers/intel_drv.so (0xb84000+0x2453b) [0xba853b]
[224197.617] 9: /usr/lib/xorg/modules/drivers/intel_drv.so (0xb84000+0x9233) [0xb8d233]
[224197.617] 10: /usr/lib/i386-linux-gnu/libdrm.so.2 (drmHandleEvent+0xce) [0x5c19ee]
[224197.617] 11: /usr/lib/xorg/modules/drivers/intel_drv.so (0xb84000+0x9297) [0xb8d297]
[224197.617] 12: /usr/bin/X (WakeupHandler+0x53) [0x8076243]
[224197.617] 13: /usr/bin/X (WaitForSomething+0x1a5) [0x80a3fa5]
[224197.617] 14: /usr/bin/X (0x8048000+0x29ed2) [0x8071ed2]
[224197.617] 15: /usr/bin/X (0x8048000+0x1c70c) [0x806470c]
[224197.617] 16: /lib/i386-linux-gnu/libc.so.6 (__libc_start_main+0xf3) [0x2dc113]
[224197.618] 17: /usr/bin/X (0x8048000+0x1ca21) [0x8064a21]
[224197.618] Segmentation fault at address 0xb2813008
[224197.630] 
Caught signal 11 (Segmentation fault). Server aborting
[224197.631] 
Please consult the The X.Org Foundation support 
         at http://wiki.x.org
 for help. 

Some of the fixes suggest forcing this module disabled. That's easily done by creating a file name /etc/X11/xorg.conf and adding the following content (also see unexpected-logout-caused-by-xorg-segmentation-fault") and restarting (at least the display manager/X):

Section  "Module"
    Disable "record"  
EndSection

That however breaks a tool I use quite a bit: Autokey. As it turns out there seems to be another workaround as outlined in Launchpad bug 774978. Basically it seems the issue occurs when Disable touchpad while typing is enabled.

So turn it off by running Mouse and Touchpad configuration then selecting the Touchpad tab and un-checking Disable touchpad while typing.

This has now had me running for well over a week without any X crashes.

\@matthias