diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-11-29 16:15:37 +1000 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2012-01-02 15:39:21 -0500 |
commit | f9b00c2aba496fe470c24d0f8d3e3d0e3b05aa65 (patch) | |
tree | 9a881e0454d546339894645936371cf933d3487a | |
parent | e4984b3023351b5fcc506f4a196ad699db8b0535 (diff) |
Xi: when removing a device, reset ClientPointers where needed
if a client had the to-be-removed device as ClientPointer, reset to NULL.
Fixes #43165
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit d2ebbcdaf6b13d70eee704b1764ff349e1be22a0)
-rw-r--r-- | Xi/xichangehierarchy.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c index 96ead6fcd..dfcd52fd0 100644 --- a/Xi/xichangehierarchy.c +++ b/Xi/xichangehierarchy.c @@ -203,6 +203,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]) { @@ -252,6 +265,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) |