mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 00:05:35 +00:00
wayland: Fix memory leaks in clipboard code
This commit is contained in:
parent
3e2f8668be
commit
674f361dec
|
@ -396,8 +396,9 @@ Wayland_data_device_clear_selection(SDL_WaylandDataDevice *data_device)
|
||||||
|
|
||||||
if (data_device == NULL || data_device->data_device == NULL) {
|
if (data_device == NULL || data_device->data_device == NULL) {
|
||||||
status = SDL_SetError("Invalid Data Device");
|
status = SDL_SetError("Invalid Data Device");
|
||||||
} else if (data_device->selection_source != 0) {
|
} else if (data_device->selection_source != NULL) {
|
||||||
wl_data_device_set_selection(data_device->data_device, NULL, 0);
|
wl_data_device_set_selection(data_device->data_device, NULL, 0);
|
||||||
|
Wayland_data_source_destroy(data_device->selection_source);
|
||||||
data_device->selection_source = NULL;
|
data_device->selection_source = NULL;
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
|
@ -444,6 +445,9 @@ Wayland_data_device_set_selection(SDL_WaylandDataDevice *data_device,
|
||||||
source->source,
|
source->source,
|
||||||
data_device->selection_serial);
|
data_device->selection_serial);
|
||||||
}
|
}
|
||||||
|
if (data_device->selection_source != NULL) {
|
||||||
|
Wayland_data_source_destroy(data_device->selection_source);
|
||||||
|
}
|
||||||
data_device->selection_source = source;
|
data_device->selection_source = source;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue