From 9b85a8b43dae9c6323348c3f7b033c0ef3a68906 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 5 Jun 2020 16:44:40 +0200 Subject: [PATCH] contributing: add note about events that destroy objects --- CONTRIBUTING.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cb75e6d5..bafbffd0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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