Commit: 09e3ea49dbbec15a8fcc79cc609f6dc8c13bc91f
Author: Campbell Barton
Date:   Thu Oct 20 08:51:24 2022 +1100
Branches: master
https://developer.blender.org/rB09e3ea49dbbec15a8fcc79cc609f6dc8c13bc91f

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.

===================================================================

M       intern/ghost/intern/GHOST_SystemWayland.cpp

===================================================================

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

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to