diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-11-29 16:15:37 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-12-09 14:56:23 +1000 |
commit | d2ebbcdaf6b13d70eee704b1764ff349e1be22a0 (patch) | |
tree | 02280b9499b8c4bb01f2bca7ad975ad6b528a196 | |
parent | 27425f07b29e0ddaa782345c1899273ca742891e (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>
-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 614d23116..a8bc761d3 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) |