diff options
author | Marius Vlad <marius.vlad@collabora.com> | 2022-02-07 11:05:14 +0200 |
---|---|---|
committer | Marius Vlad <marius.vlad@collabora.com> | 2022-05-24 19:43:58 +0300 |
commit | e4522507ad76a56e6838825e8f92779d234144f1 (patch) | |
tree | 7b77655e52cfa9d226682413f3a8dbc0e57d9eb7 | |
parent | a40ae68853d1ce18f5cdb201a83f91e7734eb114 (diff) | |
download | weston-e4522507ad76a56e6838825e8f92779d234144f1.tar.gz |
libweston: Assert if ref-count balance is wrong
Calling weston_surface_destroy() one time too many could be a sign we
haven't correctly increased the ref count for it.
Also, if we don't have a surface being passed, do no attempt to
use it.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit d3ed2eb34533e901f4d02c45058318bc3f922cb2)
-rw-r--r-- | libweston/compositor.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libweston/compositor.c b/libweston/compositor.c index 3a838ec7..ff3fa45b 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -2306,6 +2306,10 @@ weston_surface_destroy(struct weston_surface *surface) struct weston_pointer_constraint *constraint, *next_constraint; struct weston_paint_node *pnode, *pntmp; + if (!surface) + return; + + assert(surface->ref_count > 0); if (--surface->ref_count > 0) return; |