diff options
author | Campbell Barton <campbell@blender.org> | 2022-10-20 00:51:24 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-10-20 02:03:55 +0300 |
commit | 09e3ea49dbbec15a8fcc79cc609f6dc8c13bc91f (patch) | |
tree | ec5b357e1242ca731bfb9130cc405ea5070be586 | |
parent | c67975c6bb70c6f877b005bbefcef71f2045b34b (diff) |
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.
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWayland.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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<GWL_Seat *>(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); } |