Use safe iteration for seat removal.

This commit is contained in:
Armin Novak 2019-02-19 09:29:17 +01:00
parent b0ab577474
commit 073c54a368

View File

@ -132,8 +132,8 @@ static const struct zwp_fullscreen_shell_v1_listener fullscreen_shell_listener =
static void display_destroy_seat(UwacDisplay* d, uint32_t name)
{
UwacSeat* seat;
wl_list_for_each(seat, &d->seats, link)
UwacSeat* seat, *tmp;
wl_list_for_each_safe(seat, tmp, &d->seats, link)
{
if (seat->seat_id == name)
{
@ -225,12 +225,12 @@ static void registry_handle_global(void* data, struct wl_registry* registry, uin
}
else if (strcmp(interface, "wl_data_device_manager") == 0)
{
UwacSeat* seat;
UwacSeat* seat, *tmp;
d->data_device_manager = wl_registry_bind(registry, id, &wl_data_device_manager_interface,
min(TARGET_DDM_INTERFACE, version));
wl_list_for_each(seat, &d->seats, link)
wl_list_for_each_safe(seat, tmp, &d->seats, link)
{
UwacSeatRegisterDDM(seat);
UwacSeatRegisterClipboard(seat);
@ -641,12 +641,12 @@ const char* UwacErrorString(UwacReturnCode error)
UwacReturnCode UwacDisplayQueryInterfaceVersion(const UwacDisplay* display, const char* name,
uint32_t* version)
{
const UwacGlobal* global;
const UwacGlobal* global, *tmp;
if (!display)
return UWAC_ERROR_INVALID_DISPLAY;
wl_list_for_each(global, &display->globals, link)
wl_list_for_each_safe(global, tmp, &display->globals, link)
{
if (strcmp(global->interface, name) == 0)
{