[Spice-devel] [spice-gtk v2 6/7] channel-main: clipboard grab: don't fail silently

Victor Toso victortoso at redhat.com
Mon Dec 10 11:02:55 UTC 2018


From: Victor Toso <me at victortoso.com>

Spice client should listen to SpiceMainChannel::agent-connected
notification and avoid calling any clipboard related functions such as
spice_gtk_session_paste_from_guest() from client-gtk library.

This patch removes the silent return of agent_clipboard_grab() in
order to properly catch bugs with critical messages.

Signed-off-by: Victor Toso <victortoso at redhat.com>
---
 src/channel-main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/channel-main.c b/src/channel-main.c
index 223043a..aa563d2 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -1352,9 +1352,7 @@ static bool agent_clipboard_grab(SpiceMainChannel *channel, guint selection,
     size_t size;
     int i;
 
-    if (!c->agent_connected)
-        return false;
-
+    g_return_val_if_fail(c->agent_connected, false);
     g_return_val_if_fail(test_agent_cap(channel, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND), false);
 
     size = sizeof(VDAgentClipboardGrab) + sizeof(uint32_t) * ntypes;
-- 
2.19.2



More information about the Spice-devel mailing list