data-device: Handle source going away instead of ref-counting it
We have to deal with the data source going away. Even if we have a
reference to the server side data source, we can't do anything if the
client that provided the source went away. So just NULL the offers
source pointer in the destroy callback for the source.
diff --git a/src/compositor.h b/src/compositor.h
index 0f47393..f453004 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -269,15 +269,17 @@
struct wl_listener buffer_destroy_listener;
};
+struct weston_data_offer {
+ struct wl_resource resource;
+ struct weston_data_source *source;
+ struct wl_listener source_destroy_listener;
+};
+
struct weston_data_source {
struct wl_resource resource;
struct wl_array mime_types;
- int refcount;
- void *data;
- struct wl_resource *(*create_offer)(struct weston_data_source *source,
- struct wl_resource *target);
-
+ const struct wl_data_offer_interface *offer_interface;
void (*cancel)(struct weston_data_source *source);
};