wlroots-hyprland/types
Simon Ser e035f2b9c4 Fix invalid uses of wl_array_for_each
[1] and [2] have introduced new wl_array usage in wlroots, but
contains a mistake: wl_array_for_each iterates over pointers to
the wl_array entries, not over entries themselves.

Fix all wl_array_for_each call sites. Name the variables "ptr"
to avoid confusion.

Found via ASan:

    ==148752==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x602000214111 in thread T0
        #0 0x7f6ff2235f19 in __interceptor_free /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:127
        #1 0x7f6ff1c04004 in wlr_tablet_destroy ../subprojects/wlroots/types/wlr_tablet_tool.c:24
        #2 0x7f6ff1b8463c in wlr_input_device_destroy ../subprojects/wlroots/types/wlr_input_device.c:51
        #3 0x7f6ff1ab9941 in backend_destroy ../subprojects/wlroots/backend/wayland/backend.c:306
        #4 0x7f6ff1a68323 in wlr_backend_destroy ../subprojects/wlroots/backend/backend.c:57
        #5 0x7f6ff1ab36b4 in multi_backend_destroy ../subprojects/wlroots/backend/multi/backend.c:57
        #6 0x7f6ff1ab417c in handle_display_destroy ../subprojects/wlroots/backend/multi/backend.c:124
        #7 0x7f6ff106184e in wl_display_destroy (/usr/lib/libwayland-server.so.0+0x884e)
        #8 0x55cd1a77c9e5 in server_fini ../sway/server.c:218
        #9 0x55cd1a77893f in main ../sway/main.c:400
        #10 0x7f6ff04bdb24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
        #11 0x55cd1a73a7ad in _start (/home/simon/src/sway/build/sway/sway+0x33a7ad)

    0x602000214111 is located 1 bytes inside of 16-byte region [0x602000214110,0x602000214120)
    freed by thread T0 here:
        #0 0x7f6ff2235f19 in __interceptor_free /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:127
        #1 0x7f6ff1c04004 in wlr_tablet_destroy ../subprojects/wlroots/types/wlr_tablet_tool.c:24
        #2 0x7f6ff1b8463c in wlr_input_device_destroy ../subprojects/wlroots/types/wlr_input_device.c:51
        #3 0x7f6ff1ab9941 in backend_destroy ../subprojects/wlroots/backend/wayland/backend.c:306
        #4 0x7f6ff1a68323 in wlr_backend_destroy ../subprojects/wlroots/backend/backend.c:57
        #5 0x7f6ff1ab36b4 in multi_backend_destroy ../subprojects/wlroots/backend/multi/backend.c:57
        #6 0x7f6ff1ab417c in handle_display_destroy ../subprojects/wlroots/backend/multi/backend.c:124
        #7 0x7f6ff106184e in wl_display_destroy (/usr/lib/libwayland-server.so.0+0x884e)

    previously allocated by thread T0 here:
        #0 0x7f6ff2236279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
        #1 0x7f6ff1066d03 in wl_array_add (/usr/lib/libwayland-server.so.0+0xdd03)

[1]: https://github.com/swaywm/wlroots/pull/3002
[2]: https://github.com/swaywm/wlroots/pull/3004
2021-07-08 10:08:47 -04:00
..
data_device wlr_drag: Destroy drag after releasing grabs 2020-06-30 11:11:52 +02:00
seat seat: add wlr_seat_touch_{send,notify}_frame 2021-07-08 09:12:17 +02:00
tablet_v2 Fix invalid uses of wl_array_for_each 2021-07-08 10:08:47 -04:00
xdg_shell seat: add wlr_seat_touch_{send,notify}_frame 2021-07-08 09:12:17 +02:00
meson.build move wlr_box from /types to /util 2021-07-06 21:43:17 +02:00
wlr_buffer.c buffer: unify texture creation in wlr_client_buffer_import 2021-07-05 11:13:41 -04:00
wlr_compositor.c surface: make wlr_subsurface_create private 2021-06-29 10:32:17 -04:00
wlr_cursor.c cursor: add touch frame event 2021-07-08 09:12:17 +02:00
wlr_data_control_v1.c Simplify globals implementation by removing destructors 2019-11-25 09:01:46 -05:00
wlr_drm.c drm: add support for DMA-BUFs 2021-07-05 11:13:41 -04:00
wlr_export_dmabuf_v1.c export-dmabuf: export DMA-BUF on output commit 2020-11-05 09:43:42 +01:00
wlr_foreign_toplevel_management_v1.c toplevel-management: avoid redundant state events 2021-01-05 12:22:20 +01:00
wlr_fullscreen_shell_v1.c Simplify globals implementation by removing destructors 2019-11-25 09:01:46 -05:00
wlr_gamma_control_v1.c gamma-control-v1: schedule frame when resetting gamma LUT 2021-01-10 18:40:08 +01:00
wlr_idle.c Simplify globals implementation by removing destructors 2019-11-25 09:01:46 -05:00
wlr_idle_inhibit_v1.c idle-inhibit: Style and naming improvements 2020-02-20 21:40:34 +01:00
wlr_input_device.c Remove all wayland-server.h includes 2019-07-27 15:49:32 -04:00
wlr_input_inhibitor.c Make implementation function lists static const 2021-02-05 10:04:20 +01:00
wlr_input_method_v2.c input-method: send modifiers in set_keyboard 2020-11-06 19:14:55 +01:00
wlr_keyboard.c Replace wlr_key_state with wl_keyboard_key_state 2020-11-11 10:58:38 +01:00
wlr_keyboard_group.c Replace wlr_key_state with wl_keyboard_key_state 2020-11-11 10:58:38 +01:00
wlr_keyboard_shortcuts_inhibit_v1.c keyboard-shortcuts-inhibit: Implement the protocol 2020-02-20 21:40:34 +01:00
wlr_layer_shell_v1.c layer-shell: allow new values for keyboard-interactivity 2021-01-12 20:13:52 +01:00
wlr_linux_dmabuf_v1.c linux-dmabuf-v1: implement wlr_buffer 2021-05-17 16:22:43 +02:00
wlr_matrix.c move wlr_box from /types to /util 2021-07-06 21:43:17 +02:00
wlr_output.c output: detach buffer from renderer before commit 2021-07-07 12:00:43 -04:00
wlr_output_damage.c output-damage: fix output swapchain handling 2021-07-07 12:02:24 -04:00
wlr_output_layout.c move wlr_box from /types to /util 2021-07-06 21:43:17 +02:00
wlr_output_management_v1.c output-management: use same types as wlr_output 2021-01-10 16:28:19 +01:00
wlr_output_power_management_v1.c output-power-management-v1: listen to output commit 2020-08-27 13:54:19 -06:00
wlr_pointer.c Remove all wayland-server.h includes 2019-07-27 15:49:32 -04:00
wlr_pointer_constraints_v1.c move wlr_box from /types to /util 2021-07-06 21:43:17 +02:00
wlr_pointer_gestures_v1.c Simplify globals implementation by removing destructors 2019-11-25 09:01:46 -05:00
wlr_presentation_time.c Simplify globals implementation by removing destructors 2019-11-25 09:01:46 -05:00
wlr_primary_selection.c wlr_seat: Fix edge cases with serial validation 2019-06-30 15:01:05 -04:00
wlr_primary_selection_v1.c primary selection: destroy devices before manager 2021-01-05 13:53:58 +01:00
wlr_region.c region: stabilize interface 2021-07-05 09:25:25 -04:00
wlr_relative_pointer_v1.c Simplify globals implementation by removing destructors 2019-11-25 09:01:46 -05:00
wlr_screencopy_v1.c move wlr_box from /types to /util 2021-07-06 21:43:17 +02:00
wlr_server_decoration.c Simplify globals implementation by removing destructors 2019-11-25 09:01:46 -05:00
wlr_surface.c buffer: stop sending wl_buffer.release events from wlr_client_buffer 2021-07-05 11:13:41 -04:00
wlr_switch.c Remove all wayland-server.h includes 2019-07-27 15:49:32 -04:00
wlr_tablet_pad.c Fix invalid uses of wl_array_for_each 2021-07-08 10:08:47 -04:00
wlr_tablet_tool.c Fix invalid uses of wl_array_for_each 2021-07-08 10:08:47 -04:00
wlr_text_input_v3.c text_input_v3: correct typo in enum field 2021-02-15 16:33:05 +01:00
wlr_touch.c touch: add frame event 2021-07-08 09:12:17 +02:00
wlr_viewporter.c viewporter: new protocol implementation 2020-06-17 09:10:54 -06:00
wlr_virtual_keyboard_v1.c virtual_keyboard: Emulate key release events on destroy 2021-05-07 11:18:19 +02:00
wlr_virtual_pointer_v1.c Fix incorrect format parameters 2020-07-27 10:49:19 +02:00
wlr_xcursor_manager.c Make wlr_xcursor_manager_load() return a bool 2020-05-18 16:48:44 +02:00
wlr_xdg_activation_v1.c xdg-activation-v1: fix wlr_xdg_activation_v1_create error path 2021-06-17 14:48:28 +02:00
wlr_xdg_decoration_v1.c xdg-decoration: free old configure structs 2020-06-25 10:33:58 +02:00
wlr_xdg_foreign_registry.c util/uuid: replace with util/token, remove libuuid 2021-04-11 19:09:36 +02:00
wlr_xdg_foreign_v1.c xdg-foreign: rename finish_* functions to destroy_* 2021-02-08 18:09:00 +01:00
wlr_xdg_foreign_v2.c xdg-foreign: rename finish_* functions to destroy_* 2021-02-08 18:09:00 +01:00
wlr_xdg_output_v1.c xdg-output: destroy outputs before manager 2021-01-19 11:56:31 +01:00