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.
This commit is contained in:
Campbell Barton 2022-10-20 08:51:24 +11:00
parent c67975c6bb
commit 09e3ea49db
Notes: blender-bot 2023-02-14 02:43:21 +01:00
Referenced by commit c58d6b30ad, GHOST/Wayland: correct assert from recent commit
1 changed files with 6 additions and 1 deletions

View File

@ -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);
}