contributing: add note about events that destroy objects

This commit is contained in:
Simon Ser 2020-06-05 16:44:40 +02:00 committed by Drew DeVault
parent fd0a845cb4
commit 9b85a8b43d

View file

@ -293,9 +293,13 @@ this correctly.
Object structs should only be destroyed when their resource is destroyed, ie.
in the resource destroy handler (set with `wl_resource_set_implementation`).
Destructor requests should only call `wl_resource_destroy`.
The compositor should not destroy resources on its own.
- If the object has a destructor request: the request handler should just call
`wl_resource_destroy` and do nothing else. The compositor must not destroy
resources on its own outside the destructor request handler.
- If the protocol specifies that an object is destroyed when an event is sent:
it's the only case where the compositor is allowed to send the event and then
call `wl_resource_destroy`. An example of this is `wl_callback`.
### Inert resources