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 d3ed2eb345)
dev
Marius Vlad 3 years ago
parent a40ae68853
commit e4522507ad
  1. 4
      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;

Loading…
Cancel
Save