[Spice-devel] [PATCH] [spice-gtk] DND: fix special case that file size is 0

Cody Chan int64ago at gmail.com
Mon Aug 11 09:51:40 PDT 2014


On windows guest, after dragging a zero-size file, the file will be occupied
by vdagent. For spice-gtk ignores this case, and stops sending data after
sending
a start message to agent, see here for more details:
http://lists.freedesktop.org/archives/spice-devel/2014-August/017184.html
I accept the suggestion of Christophe and fix the bug in spice-gtk.
Pay attention to the modification of
​
agent_msg_queue_many,  I think it's a small trick.

​
​
---
 gtk/channel-main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 7a299a4..1e8e3f5 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -936,7 +936,7 @@ static void
​​
agent_msg_queue_many(SpiceMainChannel *channel, int type, const void
     memcpy(payload, &msg, sizeof(VDAgentMessage));
     payload += sizeof(VDAgentMessage);
     paysize -= sizeof(VDAgentMessage);
-    if (paysize == 0) {
+    if (size != 0 && paysize == 0) {
         g_queue_push_tail(c->agent_msg_queue, out);
         out = NULL;
     }
@@ -1637,7 +1637,7 @@ static void file_xfer_read_cb(GObject *source_object,
         return;
     }

-    if (count > 0) {
+    if (count >= 0) {
         task->read_bytes += count;
         file_xfer_queue(task, count);
         file_xfer_flush_async(channel, task->cancellable,
--
1.9.3​

-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20140812/d28855e0/attachment.html>


More information about the Spice-devel mailing list