From 09e3ea49dbbec15a8fcc79cc609f6dc8c13bc91f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Oct 2022 08:51:24 +1100 Subject: GHOST/Wayland: clear data source pointer when canceled The external cancel callback destroyed the data source but didn't clear the pointer. While this didn't cause problems, avoid keeping references freed pointers. --- intern/ghost/intern/GHOST_SystemWayland.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'intern/ghost') diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp index c0c55fb4cfa..5b6963dde7a 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cpp +++ b/intern/ghost/intern/GHOST_SystemWayland.cpp @@ -1277,9 +1277,14 @@ static void data_source_handle_send(void *data, close(fd); } -static void data_source_handle_cancelled(void * /*data*/, struct wl_data_source *wl_data_source) +static void data_source_handle_cancelled(void *data, struct wl_data_source *wl_data_source) { CLOG_INFO(LOG, 2, "cancelled"); + GWL_Seat *seat = static_cast(data); + GWL_DataSource *data_source = seat->data_source; + GHOST_ASSERT(seat->data_source->wl_data_source == wl_data_source, "Data source mismatch!"); + data_source->wl_data_source = nullptr; + wl_data_source_destroy(wl_data_source); } -- cgit v1.2.3