DeviceIntRec changes cause segfaults

Alan Coopersmith alan.coopersmith at sun.com
Thu Nov 16 08:31:12 PST 2006


Peter Hutterer wrote:
> Hey guys,
> 
> I just found out the following:
> 
> Adding a field to the struct _DeviceIntRec in xserver/include/inputstr.h 
> will cause the sever to segfault upon initialisation of the keyboard.
> 
> <snippet>
> typedef struct _DeviceIntRec {
>     DeviceRec    public;
>     DeviceIntPtr next;
>     TimeStamp    grabTime;
>     Bool    startup;        /* true if needs to be turned on at
>                           server intialization time */
>     DeviceProc    deviceProc;        /* proc(DevicePtr, DEVICE_xx). It is
>                       used to initialize, turn on, or
>                       turn off the device */
>     Bool    inited;            /* TRUE if INIT returns Success */
>     Bool        enabled;                /* TRUE if ON returns Success */
>     Bool        coreEvents;             /* TRUE if device also sends 
> core */
> #ifdef MPX
>     Bool        isMPDev;                /* TRUE if multipointer device */
> #endif
>     GrabPtr    grab;            /* the grabber - used by DIX */

Adding new fields in the middle of existing structures is just asking for
pain.  Unless there's a very good reason (not just style), add new entries
to the end.

-- 
	-Alan Coopersmith-           alan.coopersmith at sun.com
	 Sun Microsystems, Inc. - X Window System Engineering



More information about the xorg mailing list