diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c index c7ea5aa8f4..26faad8ac5 100644 --- a/gdk/wayland/gdkdevice-wayland.c +++ b/gdk/wayland/gdkdevice-wayland.c @@ -1007,6 +1007,7 @@ _request_content_io_func (GIOChannel *channel, closure->cb (closure->device->pointer, data, len, closure->userdata); + g_free (data); data_offer_unref (closure->offer); g_io_channel_unref (channel); g_free (closure); @@ -1099,8 +1100,8 @@ data_source_send (void *data, int32_t fd) { GdkWaylandSelectionOffer *offer = (GdkWaylandSelectionOffer *)data;; - const gchar *buf; - gssize len, bytes_written; + gchar *buf; + gssize len, bytes_written = 0; g_debug (G_STRLOC ": %s source = %p, mime_type = %s fd = %d", G_STRFUNC, source, mime_type, fd); @@ -1109,13 +1110,14 @@ data_source_send (void *data, while (len > 0) { - bytes_written = write (fd, buf, len); + bytes_written += write (fd, buf + bytes_written, len); if (bytes_written == -1) goto error; len -= bytes_written; } close (fd); + g_free (buf); return; error: @@ -1124,6 +1126,7 @@ error: g_strerror (errno)); close (fd); + g_free (buf); } static void diff --git a/gdk/wayland/gdkwayland.h b/gdk/wayland/gdkwayland.h index 8c964c99b9..97d5ad21e9 100644 --- a/gdk/wayland/gdkwayland.h +++ b/gdk/wayland/gdkwayland.h @@ -39,7 +39,7 @@ int gdk_wayland_device_get_selection_type_atoms (GdkDevice *device, GdkAtom **atoms_out); -typedef void (*GdkDeviceWaylandRequestContentCallback) (GdkDevice *device, gchar *data, gsize len, gpointer userdata); +typedef void (*GdkDeviceWaylandRequestContentCallback) (GdkDevice *device, const gchar *data, gsize len, gpointer userdata); #define gdk_wayland_device_request_selection_content gdk_wayland_device_request_selection_content_libgtk_only gboolean @@ -48,7 +48,7 @@ gdk_wayland_device_request_selection_content (GdkDevice GdkDeviceWaylandRequestContentCallback cb, gpointer userdata); -typedef const gchar *(*GdkDeviceWaylandOfferContentCallback) (GdkDevice *device, const gchar *mime_type, gssize *len, gpointer userdata); +typedef gchar *(*GdkDeviceWaylandOfferContentCallback) (GdkDevice *device, const gchar *mime_type, gssize *len, gpointer userdata); #define gdk_wayland_device_offer_selection_content gdk_wayland_device_offer_selection_content_libgtk_only gboolean