[PATCH xserver] present: Handle event mask updates as specified

Keith Packard keithp at keithp.com
Thu Jul 28 16:54:22 UTC 2016


Michel Dänzer <michel at daenzer.net> writes:

> Without this change, there's no way for a client to explicitly change
> or destroy an existing event mask entry. Trying to do so as specified
> above would actually result in a new entry being created with
> the mask value passed in.

Yup, this looks like a good thing to fix.

Instead of walking the linked list, you should perform a resource lookup
instead using the provided ID; that would be more consistent, and would
let you catch errors where the provided resource ID was actually being
used on a different window. If it does, you should return a Match error.

You've also lost the call to LEGAL_NEW_RESOURCE in the path which
creates a new event.

> While we're at it, fix a memory leak if AddResource fails.

You've made a very common mistake -- AddResource actually calls the
delete function when it fails, so you don't need to free the object in
the failure path.

Here's an alternate (untested) patch which shows what I meant; use
whatever bits of this seem useful.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-present-Handle-event-mask-updates-as-specified.patch
Type: text/x-diff
Size: 3264 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20160728/0932c1bb/attachment.patch>
-------------- next part --------------

-- 
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 810 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20160728/0932c1bb/attachment.sig>


More information about the xorg-devel mailing list