[gtk+] wayland: Properly initialize/finalize where we store the data_source.send fd



commit 25885ca600fffcade4f3a77019d8cca17d9ec325
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jun 24 11:27:20 2015 +0200

    wayland: Properly initialize/finalize where we store the data_source.send fd
    
    The fd must be closed on async_write_data_free(), but we should also
    initialize it to -1 so gdk_wayland_selection_check_write() doesn't wrongly
    pick the stdin fd.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751414

 gdk/wayland/gdkselection-wayland.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gdk/wayland/gdkselection-wayland.c b/gdk/wayland/gdkselection-wayland.c
index a2b83ba..dbe1d63 100644
--- a/gdk/wayland/gdkselection-wayland.c
+++ b/gdk/wayland/gdkselection-wayland.c
@@ -272,6 +272,7 @@ gdk_wayland_selection_new (void)
   selection->selection_buffers =
       g_hash_table_new_full (NULL, NULL, NULL,
                              (GDestroyNotify) selection_buffer_cancel_and_unref);
+  selection->stored_selection.fd = -1;
   return selection;
 }
 
@@ -399,6 +400,8 @@ async_write_data_new (GdkWaylandSelection *selection)
 static void
 async_write_data_free (AsyncWriteData *write_data)
 {
+  close (write_data->selection->stored_selection.fd);
+  write_data->selection->stored_selection.fd = -1;
   g_object_unref (write_data->stream);
   g_slice_free (AsyncWriteData, write_data);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]