mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
CONTRIBUTING.md: mention listener list assertions
This commit is contained in:
parent
b25f98d583
commit
980ac9e4c8
1 changed files with 21 additions and 0 deletions
|
|
@ -213,6 +213,27 @@ reinitialized to be used again.
|
||||||
it, and free the memory. Such functions should always be able to accept a NULL
|
it, and free the memory. Such functions should always be able to accept a NULL
|
||||||
pointer.
|
pointer.
|
||||||
|
|
||||||
|
If the object has signals, the destructor function must assert that their
|
||||||
|
listener lists are empty.
|
||||||
|
|
||||||
|
```c
|
||||||
|
void wlr_thing_init(struct wlr_thing *thing) {
|
||||||
|
*thing = (struct wlr_thing){
|
||||||
|
// ...
|
||||||
|
};
|
||||||
|
|
||||||
|
wl_signal_init(&thing->events.destroy);
|
||||||
|
wl_signal_init(&thing->events.foo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wlr_thing_finish(struct wlr_thing *thing) {
|
||||||
|
wl_signal_emit_mutable(&thing->events.destroy, NULL);
|
||||||
|
|
||||||
|
assert(wl_list_empty(&thing->events.destroy.listener_list));
|
||||||
|
assert(wl_list_empty(&thing->events.foo.listener_list));
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### Error Codes
|
### Error Codes
|
||||||
|
|
||||||
For functions not returning a value, they should return a (stdbool.h) bool to
|
For functions not returning a value, they should return a (stdbool.h) bool to
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue