[PATCH] Xi: when removing a device, reset ClientPointers where needed

Jeremy Huddleston jeremyhu at apple.com
Tue Nov 29 23:44:00 PST 2011


It does what it says, so...

Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

but I'm always cautious about these changes since there may be something I'm missing here...

On Nov 29, 2011, at 3:18 PM, Peter Hutterer wrote:

> If a client had the to-be-removed device as ClientPointer, reset to NULL.
> 
> Fixes http://bugs.freedesktop.org/43165
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> Xi/xichangehierarchy.c |   15 +++++++++++++++
> 1 files changed, 15 insertions(+), 0 deletions(-)
> 
> diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
> index 614d231..a8bc761 100644
> --- a/Xi/xichangehierarchy.c
> +++ b/Xi/xichangehierarchy.c
> @@ -201,6 +201,19 @@ unwind:
> }
> 
> static int
> +disable_clientpointer(DeviceIntPtr dev)
> +{
> +    int i;
> +
> +    for (i = 0; i < currentMaxClients; i++)
> +    {
> +        ClientPtr client = clients[i];
> +        if (client && client->clientPtr == dev)
> +            client->clientPtr = NULL;
> +    }
> +}
> +
> +static int
> remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
>               int flags[MAXDEVICES])
> {
> @@ -250,6 +263,8 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
>     if (rc != Success)
>         goto unwind;
> 
> +    disable_clientpointer(ptr);
> +
>     /* Disabling sends the devices floating, reattach them if
>      * desired. */
>     if (r->return_mode == XIAttachToMaster)
> -- 
> 1.7.7.1
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 



More information about the xorg-devel mailing list