mirror of https://github.com/encounter/SDL.git
wayland: Don't double-free clipboard sources if ours gets cancelled.
Fixes #6007.
This commit is contained in:
parent
3da131c1c6
commit
a6179e85c0
|
@ -322,6 +322,10 @@ void
|
||||||
Wayland_data_source_destroy(SDL_WaylandDataSource *source)
|
Wayland_data_source_destroy(SDL_WaylandDataSource *source)
|
||||||
{
|
{
|
||||||
if (source != NULL) {
|
if (source != NULL) {
|
||||||
|
SDL_WaylandDataDevice *data_device = (SDL_WaylandDataDevice *) source->data_device;
|
||||||
|
if (data_device && (data_device->selection_source == source)) {
|
||||||
|
data_device->selection_source = NULL;
|
||||||
|
}
|
||||||
wl_data_source_destroy(source->source);
|
wl_data_source_destroy(source->source);
|
||||||
mime_data_list_free(&source->mimes);
|
mime_data_list_free(&source->mimes);
|
||||||
SDL_free(source);
|
SDL_free(source);
|
||||||
|
@ -449,6 +453,7 @@ Wayland_data_device_set_selection(SDL_WaylandDataDevice *data_device,
|
||||||
Wayland_data_source_destroy(data_device->selection_source);
|
Wayland_data_source_destroy(data_device->selection_source);
|
||||||
}
|
}
|
||||||
data_device->selection_source = source;
|
data_device->selection_source = source;
|
||||||
|
source->data_device = data_device;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
struct wl_data_source *source;
|
struct wl_data_source *source;
|
||||||
struct wl_list mimes;
|
struct wl_list mimes;
|
||||||
|
void *data_device;
|
||||||
} SDL_WaylandDataSource;
|
} SDL_WaylandDataSource;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
Loading…
Reference in New Issue