diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-09-02 11:16:15 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-09-03 08:39:27 +1000 |
commit | 377a5f655ca88cd836da24ab42361df9f3ff51a2 (patch) | |
tree | bc6001f642d3fedc6230216663872c2ebd6033c2 /Xi | |
parent | 993ca5acbdccef9e43cd6580e7cc22cfda1a2578 (diff) |
Xi: if XISetEventMask fails, return this to the client.
The only failure point can be a BadAlloc.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'Xi')
-rw-r--r-- | Xi/exevents.c | 7 | ||||
-rw-r--r-- | Xi/xiselectev.c | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c index b1412f018..7f77aa872 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -2128,7 +2128,7 @@ SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count) * @param len Number of bytes in mask. * @param mask Event mask in the form of (1 << eventtype) */ -void +int XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client, unsigned int len, unsigned char* mask) { @@ -2152,7 +2152,8 @@ XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client, if (len && !others) { - AddExtensionClient(win, client, 0, 0); + if (AddExtensionClient(win, client, 0, 0) != Success) + return BadAlloc; others= wOtherInputMasks(win)->inputClients; } @@ -2163,4 +2164,6 @@ XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client, memcpy(others->xi2mask[dev->id], mask, len); RecalculateDeviceDeliverableEvents(win); + + return Success; } diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c index 16eada7c8..672edab3b 100644 --- a/Xi/xiselectev.c +++ b/Xi/xiselectev.c @@ -164,7 +164,9 @@ ProcXISelectEvents(ClientPtr client) dev = &dummy; } else dixLookupDevice(&dev, evmask->deviceid, client, DixUseAccess); - XISetEventMask(dev, win, client, evmask->mask_len * 4, (unsigned char*)&evmask[1]); + if (XISetEventMask(dev, win, client, evmask->mask_len * 4, + (unsigned char*)&evmask[1]) != Success) + return BadAlloc; evmask = (xXIEventMask*)(((unsigned char*)evmask) + evmask->mask_len * 4); evmask++; } |