[Spice-devel] [PATCH 2/3] Handle reference for RedPipeItem in RedChannel

Frediano Ziglio fziglio at redhat.com
Fri May 20 09:28:27 UTC 2016


Remove the need to release the item inside send_item callbacks.
This looks like a partial rollback of previous patch but is
to make clear the intention of the change.
The lifetime of items could extend a bit further but there
are no cases this small lag should cause problems.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/cursor-channel.c | 1 -
 server/dcc-send.c       | 2 --
 server/inputs-channel.c | 1 -
 server/main-channel.c   | 2 --
 server/red-channel.c    | 2 +-
 server/smartcard.c      | 2 --
 server/spicevmc.c       | 2 --
 7 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 104bf51..949cbc4 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -336,7 +336,6 @@ static void cursor_channel_send_item(RedChannelClient *rcc, RedPipeItem *pipe_it
         spice_error("invalid pipe item type");
     }
 
-    red_pipe_item_unref(pipe_item);
     red_channel_client_begin_send_message(rcc);
 }
 
diff --git a/server/dcc-send.c b/server/dcc-send.c
index f0f2e16..05da07f 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -2455,8 +2455,6 @@ void dcc_send_item(DisplayChannelClient *dcc, RedPipeItem *pipe_item)
         spice_warn_if_reached();
     }
 
-    red_pipe_item_unref(pipe_item);
-
     // a message is pending
     if (red_channel_client_send_message_pending(rcc)) {
         begin_send_message(rcc);
diff --git a/server/inputs-channel.c b/server/inputs-channel.c
index 3218a48..4b5813f 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -289,7 +289,6 @@ static void inputs_channel_send_item(RedChannelClient *rcc, RedPipeItem *base)
             spice_warning("invalid pipe iten %d", base->type);
             break;
     }
-    red_pipe_item_unref(base);
     red_channel_client_begin_send_message(rcc);
 }
 
diff --git a/server/main-channel.c b/server/main-channel.c
index 219212c..70aaff7 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -723,7 +723,6 @@ static void main_channel_send_item(RedChannelClient *rcc, RedPipeItem *base)
         spice_printerr("Init msg for client %p was not sent yet "
                        "(client is probably during semi-seamless migration). Ignoring msg type %d",
                    rcc->client, base->type);
-        red_pipe_item_unref(base);
         return;
     }
     switch (base->type) {
@@ -789,7 +788,6 @@ static void main_channel_send_item(RedChannelClient *rcc, RedPipeItem *base)
             main_channel_marshall_agent_connected(m, rcc, base);
             break;
     };
-    red_pipe_item_unref(base);
     red_channel_client_begin_send_message(rcc);
 }
 
diff --git a/server/red-channel.c b/server/red-channel.c
index 8226bc4..23defc0 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -576,7 +576,7 @@ static void red_channel_client_send_item(RedChannelClient *rcc, RedPipeItem *ite
             break;
         default:
             rcc->channel->channel_cbs.send_item(rcc, item);
-            return;
+            break;
     }
     red_pipe_item_unref(item);
 }
diff --git a/server/smartcard.c b/server/smartcard.c
index e68ccdc..c39aeae 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -498,10 +498,8 @@ static void smartcard_channel_send_item(RedChannelClient *rcc, RedPipeItem *item
         break;
     default:
         spice_error("bad pipe item %d", item->type);
-        red_pipe_item_unref(item);
         return;
     }
-    red_pipe_item_unref(item);
     red_channel_client_begin_send_message(rcc);
 }
 
diff --git a/server/spicevmc.c b/server/spicevmc.c
index be51d54..1e68909 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -425,10 +425,8 @@ static void spicevmc_red_channel_send_item(RedChannelClient *rcc,
         break;
     default:
         spice_error("bad pipe item %d", item->type);
-        red_pipe_item_unref(item);
         return;
     }
-    red_pipe_item_unref(item);
     red_channel_client_begin_send_message(rcc);
 }
 
-- 
2.7.4



More information about the Spice-devel mailing list