weston/include/libweston
Marius Vlad bd8314078d libweston, desktop-shell: Add a wrapper for weston_surface reference
Similar to how we do it with drm_fb ref counts, increase a reference
count and return the same object.

Plug-in in desktop-shell when we map up the view in order to survive a
weston_surface destruction.

Astute readers will notice that this patch removes weston_view_destroy()
while keeping the balance between removing and adding a
weston_surface_unref() call in desktop_shell_destroy_surface().

The reason is to let weston_surface_unref() handle destruction on its
own. If multiple references are taken, then weston_surface_unref()
doesn't destroy the view, it just decreases the reference, with
a latter call to weston_surface_unref() to determine if the view
should be destroyed as well.  This situation happens if we have
close animation enabled, were we have more than one reference taken: one
when mapping the view/surface and when when the surface itself was created,
(what we call, a weak reference).

If only a single reference is taken (for instance if we don't have close
animations enabled) then this weston_surface_unref()
call is inert as that reference is not set-up, leaving libweston to
handle the view destruction.

Following that with a weston_view_destroy() explicit call would cause a
UAF as the view was previous destroyed by a weston_surface_unref() call.

A side-effect of not keeping the weston_view_destroy() call would
happen when tearing down the compositor. If close animations are enabled,
weston_surface_unref() would not destroy the view, and because
weston_view_destroy() no longer exists, we would still have the
view in the other layers by the time we check-up if layers
have views present.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-05-12 16:53:34 +03:00
..
backend-drm.h launchers: Remove --tty option 2022-03-03 17:00:15 -06:00
backend-headless.h headless, gl-renderer: support pbuffer outputs 2019-10-11 12:16:35 +00:00
backend-rdp.h rdp: Allow configuring the refresh rate 2022-04-28 07:35:57 -05:00
backend-wayland.h Rename public backend headers 2019-04-18 12:31:46 +03:00
backend-x11.h Rename public backend headers 2019-04-18 12:31:46 +03:00
config-parser.h include: drop unused config-parser.h types 2022-03-14 08:50:30 +00:00
libweston.h libweston, desktop-shell: Add a wrapper for weston_surface reference 2022-05-12 16:53:34 +03:00
matrix.h Rename matrix.h to libweston/matrix.h 2019-04-18 12:31:46 +03:00
meson.build libweston: remove fbdev backend 2022-03-15 11:32:46 +02:00
pipewire-plugin.h plug-ins: Migrate pipewire and remoting plug-ins headers to public header 2020-09-04 10:36:48 +00:00
plugin-registry.h Rename plugin-registry.h to libweston/plugin-registry.h 2019-04-18 12:31:46 +03:00
remoting-plugin.h plug-ins: Migrate pipewire and remoting plug-ins headers to public header 2020-09-04 10:36:48 +00:00
version.h.in Rename version.h to libweston/version.h 2019-04-18 12:31:46 +03:00
weston-log.h weston-log: Extract helper for generating a time stamp 2022-03-10 17:11:31 +02:00
windowed-output-api.h Fix indentation all through the project 2021-07-31 15:28:20 +00:00
xwayland-api.h Rename xwayland-api.h to libweston/xwayland-api.h 2019-04-18 12:31:46 +03:00
zalloc.h Rename zalloc.h to libweston/zalloc.h 2019-04-18 12:31:46 +03:00