Blame SOURCES/0005-vdagent-x11-Release-clipboard-on-client-disconnect-i.patch

7ce03f
From ad6ea7594a11d8a35be84a8ae2e8403ea3344a3b Mon Sep 17 00:00:00 2001
7ce03f
From: Hans de Goede <hdegoede@redhat.com>
7ce03f
Date: Mon, 9 Sep 2013 15:50:39 +0200
7ce03f
Subject: [linux-vdagent PATCH 5/5] vdagent-x11: Release clipboard on client
7ce03f
 disconnect if owned by client
7ce03f
7ce03f
https://bugzilla.redhat.com/show_bug.cgi?id=1003977
7ce03f
7ce03f
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
7ce03f
---
7ce03f
 src/vdagent-x11.c | 10 ++++++++++
7ce03f
 src/vdagent-x11.h |  2 ++
7ce03f
 src/vdagent.c     |  1 +
7ce03f
 3 files changed, 13 insertions(+)
7ce03f
7ce03f
diff --git a/src/vdagent-x11.c b/src/vdagent-x11.c
7ce03f
index 4588b3d..5ce6000 100644
7ce03f
--- a/src/vdagent-x11.c
7ce03f
+++ b/src/vdagent-x11.c
7ce03f
@@ -1305,6 +1305,16 @@ void vdagent_x11_clipboard_release(struct vdagent_x11 *x11, uint8_t selection)
7ce03f
     vdagent_x11_do_read(x11);
7ce03f
 }
7ce03f
 
7ce03f
+void vdagent_x11_client_disconnected(struct vdagent_x11 *x11)
7ce03f
+{
7ce03f
+    int sel;
7ce03f
+
7ce03f
+    for (sel = 0; sel < VD_AGENT_CLIPBOARD_SELECTION_SECONDARY; sel++) {
7ce03f
+        if (x11->clipboard_owner[sel] == owner_client)
7ce03f
+            vdagent_x11_clipboard_release(x11, sel);
7ce03f
+    }
7ce03f
+}
7ce03f
+
7ce03f
 /* Function used to determine the default location to save file-xfers,
7ce03f
    xdg desktop dir or xdg download dir. We error on the save side and use a
7ce03f
    whitelist approach, so any unknown desktops will end up with saving
7ce03f
diff --git a/src/vdagent-x11.h b/src/vdagent-x11.h
7ce03f
index a2a2485..d64a42a 100644
7ce03f
--- a/src/vdagent-x11.h
7ce03f
+++ b/src/vdagent-x11.h
7ce03f
@@ -46,6 +46,8 @@ void vdagent_x11_clipboard_data(struct vdagent_x11 *x11, uint8_t selection,
7ce03f
     uint32_t type, uint8_t *data, uint32_t size);
7ce03f
 void vdagent_x11_clipboard_release(struct vdagent_x11 *x11, uint8_t selection);
7ce03f
 
7ce03f
+void vdagent_x11_client_disconnected(struct vdagent_x11 *x11);
7ce03f
+
7ce03f
 int vdagent_x11_has_icons_on_desktop(struct vdagent_x11 *x11);
7ce03f
 
7ce03f
 #endif
7ce03f
diff --git a/src/vdagent.c b/src/vdagent.c
7ce03f
index f270615..d7f7aba 100644
7ce03f
--- a/src/vdagent.c
7ce03f
+++ b/src/vdagent.c
7ce03f
@@ -104,6 +104,7 @@ void daemon_read_complete(struct udscs_connection **connp,
7ce03f
         free(data);
7ce03f
         break;
7ce03f
     case VDAGENTD_CLIENT_DISCONNECTED:
7ce03f
+        vdagent_x11_client_disconnected(x11);
7ce03f
         vdagent_file_xfers_destroy(vdagent_file_xfers);
7ce03f
         vdagent_file_xfers = vdagent_file_xfers_create(client, fx_dir,
7ce03f
                                                        fx_open_dir, debug);
7ce03f
-- 
7ce03f
1.8.3.1
7ce03f