weston/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 backend-drm: Add failure reasons for failing gbm_bo_import 2022-05-12 11:53:04 +00:00
backend-headless backend-headless: support all EOTF modes 2022-05-02 12:19:24 +00:00
backend-rdp rdp: Add US international keyboard layout 2022-05-09 08:56:23 -05:00
backend-wayland compositor: remove repaint_data from compositor 2022-04-06 12:47:05 +02:00
backend-x11 compositor: remove repaint_data from compositor 2022-04-06 12:47:05 +02:00
color-lcms color-lcms: refactor away setup_seach_param() 2022-05-06 09:33:35 +00:00
renderer-gl libweston: add struct weston_output_color_outcome 2022-05-06 09:33:35 +00:00
animation.c Fix indentation all through the project 2021-07-31 15:28:20 +00:00
backend.h libweston: introduce weston_eotf_mode 2022-05-02 12:19:24 +00:00
bindings.c Don't send compositor's global key bindings to the input method 2022-02-23 15:40:33 +02:00
clipboard.c libweston: correct argument name in the handler of wl_data_source.accept 2022-04-14 12:05:57 +00:00
color-noop.c color: simplify color manager API with weston_output_color_outcome 2022-05-06 09:33:35 +00:00
color.c backend-drm: check for HDR_OUTPUT_METADATA 2022-05-02 12:19:24 +00:00
color.h color: simplify color manager API with weston_output_color_outcome 2022-05-06 09:33:35 +00:00
compositor.c libweston, desktop-shell: Add a wrapper for weston_surface reference 2022-05-12 16:53:34 +03:00
content-protection.c content-protection: Don't leak update timer on shutdown 2021-12-08 13:38:18 +00:00
data-device.c weston_buffer: Prepare for buffer to outlive resource 2022-04-25 14:27:08 +00:00
dbus.c dbus: Don't return value from void function 2019-06-11 11:31:04 +01:00
dbus.h Rename compositor.h to libweston/libweston.h 2019-04-18 12:31:46 +03:00
drm-formats.c drm-formats: add weston_drm_format_array_count_pairs() 2021-11-25 10:47:45 -03:00
git-version.h.meson Add Meson build system 2018-12-09 14:50:54 +02:00
input.c input: Fix bug in idle inhibition 2022-04-18 12:10:20 +00:00
launcher-impl.h launchers: Remove --tty option 2022-03-03 17:00:15 -06:00
launcher-libseat.c libweston: Enable logging for libseat launcher 2022-03-10 17:13:16 +02:00
launcher-logind.c launcher-logind: Don't check wl->vtnr before returning it. 2022-03-16 13:12:20 +00:00
launcher-util.c launchers: Remove --tty option 2022-03-03 17:00:15 -06:00
launcher-util.h launchers: Remove --tty option 2022-03-03 17:00:15 -06:00
libinput-device.c Fix indentation all through the project 2021-07-31 15:28:20 +00:00
libinput-device.h Rename compositor.h to libweston/libweston.h 2019-04-18 12:31:46 +03:00
libinput-seat.c libinput-seat: Cascade errors and bail out in case of failure 2021-11-25 10:47:04 +02:00
libinput-seat.h Rename compositor.h to libweston/libweston.h 2019-04-18 12:31:46 +03:00
libweston-internal.h weston_buffer: Add mode to weston_buffer_reference 2022-04-25 14:27:08 +00:00
linux-dmabuf.c libweston/linux-dmabuf: create surface feedback on demand 2022-05-12 11:53:04 +00:00
linux-dmabuf.h backend-drm: add KMS plane's formats to per-surface dma-buf feedback 2021-11-25 11:16:52 -03:00
linux-explicit-synchronization.c libweston: Advertise minor version 2 of zwp_linux_explicit_synchronization_v1 2019-08-02 15:00:08 +00:00
linux-explicit-synchronization.h libweston: Support zwp_surface_synchronization_v1.set_acquire_fence 2019-02-06 12:21:56 +00:00
linux-sync-file-uapi.h libweston: Introduce an internal linux sync file API 2019-02-06 12:21:56 +00:00
linux-sync-file.c libweston: export weston_linux_sync_file_read_timestamp() 2019-04-18 12:50:55 +03:00
linux-sync-file.h libweston: export weston_linux_sync_file_read_timestamp() 2019-04-18 12:50:55 +03:00
log.c Fix indentation all through the project 2021-07-31 15:28:20 +00:00
meson.build libweston: remove fbdev backend 2022-03-15 11:32:46 +02:00
noop-renderer.c libweston: Remove weston_surface_set_color 2022-04-25 14:27:08 +00:00
pixel-formats.c pixel-formats: Add XYUV8888 format 2022-03-31 17:15:55 +00:00
pixel-formats.h pixman-renderer: track Pixman formats in pixel format table 2021-09-15 15:00:29 +03:00
pixman-renderer.c libweston: add struct weston_output_color_outcome 2022-05-06 09:33:35 +00:00
pixman-renderer.h pixman-renderer: Replace output-create flags with struct 2020-03-20 15:25:24 +00:00
plugin-registry.c Rename plugin-registry.h to libweston/plugin-registry.h 2019-04-18 12:31:46 +03:00
screenshooter.c weston_buffer: Make use of weston_buffer->type 2022-04-25 14:27:08 +00:00
spring-tool.c Rename compositor.h to libweston/libweston.h 2019-04-18 12:31:46 +03:00
timeline.c libweston: fix typos 2021-02-24 10:01:17 -05:00
timeline.h libweston: move TYPEVERIFY macro into shared 2021-02-17 12:52:33 +00:00
touch-calibration.c touch-calibration: Clean-up if touch calibrator has been enabled 2022-04-20 08:27:17 +00:00
vertex-clipping.c tests: make vertex-clip use WESTON_EXPORT_FOR_TESTS 2022-03-01 13:32:15 +00:00
vertex-clipping.h Rename src/ to libweston/ 2016-06-23 17:44:54 +03:00
weston-direct-display.c libweston: Add weston-direct-display server side implementation 2019-11-18 19:33:09 +02:00
weston-log-file.c weston-log: destroy subscriptions with destruction of subscribers 2020-02-10 10:53:50 +00:00
weston-log-flight-rec.c weston-log: destroy subscriptions with destruction of subscribers 2020-02-10 10:53:50 +00:00
weston-log-internal.h weston-log-wayland: make stream_destroy() use weston_log_subscriber_release() 2020-02-10 10:53:50 +00:00
weston-log-wayland.c Fix indentation all through the project 2021-07-31 15:28:20 +00:00
weston-log.c weston-log: Extract helper for generating a time stamp 2022-03-10 17:11:31 +02:00