[Spice-commits] 7 commits - server/cursor-channel.c server/dcc-send.c server/inputs-channel-client.c server/inputs-channel.c server/main-channel-client.c server/red-channel-client-private.h server/red-channel-client.c server/red-channel-client.h server/red-pipe-item.c server/red-pipe-item.h server/smartcard-channel-client.c server/smartcard.c server/spicevmc.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Tue Dec 20 16:12:19 UTC 2016


 server/cursor-channel.c             |   44 ++++++---------
 server/dcc-send.c                   |  102 +++++++++++++++++++++---------------
 server/inputs-channel-client.c      |    2 
 server/inputs-channel.c             |    6 +-
 server/main-channel-client.c        |   36 ++++++------
 server/red-channel-client-private.h |    2 
 server/red-channel-client.c         |   26 +--------
 server/red-channel-client.h         |    2 
 server/red-pipe-item.c              |    6 ++
 server/red-pipe-item.h              |    4 +
 server/smartcard-channel-client.c   |    8 ++
 server/smartcard.c                  |    2 
 server/spicevmc.c                   |   14 ++--
 13 files changed, 133 insertions(+), 121 deletions(-)

New commits:
commit 0ace8a81c7d673b8a82a75358eb434db3b197486
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Tue Dec 20 09:59:51 2016 -0600

    Remove third argument from red_channel_client_init_send_data()
    
    This third argument (and the 'item' member of
    RedChannelClient::priv::send_data) was a somewhat roundabout way to keep
    the RedPipeItem alive until a message is sent, just in case some data
    owned by that pipeitem was added to the marshaller by reference. This
    was a rather confusing mechanism, however, since it did not have any
    obvious connection to the _add_by_ref() call. It was never very clear
    whether you needed to pass an item to this function or not. The previous
    series of patches made this parameter unnecessary since the referencing
    of the pipe item (or other related structure) is now more explicitly
    connected to the calls to spice_marshaller_add_by_ref_full().
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 9af1db2..b3cbb96 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -191,7 +191,7 @@ static void red_marshall_cursor_init(CursorChannelClient *ccc, SpiceMarshaller *
     spice_assert(rcc);
     cursor_channel = CURSOR_CHANNEL(red_channel_client_get_channel(rcc));
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_INIT, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_INIT);
     msg.visible = cursor_channel->cursor_visible;
     msg.position = cursor_channel->cursor_position;
     msg.trail_length = cursor_channel->cursor_trail_length;
@@ -217,7 +217,7 @@ static void cursor_marshall(CursorChannelClient *ccc,
     case QXL_CURSOR_MOVE:
         {
             SpiceMsgCursorMove cursor_move;
-            red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_MOVE, NULL);
+            red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_MOVE);
             cursor_move.position = cmd->u.position;
             spice_marshall_msg_cursor_move(m, &cursor_move);
             break;
@@ -226,7 +226,7 @@ static void cursor_marshall(CursorChannelClient *ccc,
         {
             SpiceMsgCursorSet cursor_set;
 
-            red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_SET, NULL);
+            red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_SET);
             cursor_set.position = cmd->u.set.position;
             cursor_set.visible = cursor_channel->cursor_visible;
 
@@ -235,13 +235,13 @@ static void cursor_marshall(CursorChannelClient *ccc,
             break;
         }
     case QXL_CURSOR_HIDE:
-        red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_HIDE, NULL);
+        red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_HIDE);
         break;
     case QXL_CURSOR_TRAIL:
         {
             SpiceMsgCursorTrail cursor_trail;
 
-            red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_TRAIL, NULL);
+            red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_TRAIL);
             cursor_trail.length = cmd->u.trail.length;
             cursor_trail.frequency = cmd->u.trail.frequency;
             spice_marshall_msg_cursor_trail(m, &cursor_trail);
@@ -258,7 +258,7 @@ static inline void red_marshall_inval(RedChannelClient *rcc,
 {
     SpiceMsgDisplayInvalOne inval_one;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_INVAL_ONE, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_INVAL_ONE);
     inval_one.id = cach_item->id;
 
     spice_marshall_msg_cursor_inval_one(base_marshaller, &inval_one);
@@ -282,7 +282,7 @@ static void cursor_channel_send_item(RedChannelClient *rcc, RedPipeItem *pipe_it
         break;
     case RED_PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE:
         cursor_channel_client_reset_cursor_cache(rcc);
-        red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_INVAL_ALL, NULL);
+        red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_INVAL_ALL);
         break;
     default:
         spice_error("invalid pipe item type");
diff --git a/server/dcc-send.c b/server/dcc-send.c
index b6afefb..ab5f010 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -285,12 +285,12 @@ static void send_free_list(RedChannelClient *rcc)
 
     if (!free_list->wait.header.wait_count) {
         /* only one message, no need for a list */
-        red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_LIST, NULL);
+        red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_LIST);
         spice_marshall_msg_display_inval_list(urgent_marshaller, free_list->res);
         return;
     }
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_LIST, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_LIST);
 
     /* append invalidate list */
     inval_m = spice_marshaller_get_submarshaller(urgent_marshaller);
@@ -554,7 +554,7 @@ static void marshall_qxl_draw_fill(RedChannelClient *rcc,
     SpiceMarshaller *mask_bitmap_out;
     SpiceFill fill;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_FILL, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_FILL);
     fill_base(base_marshaller, item);
     fill = drawable->u.fill;
     spice_marshall_Fill(base_marshaller,
@@ -898,7 +898,7 @@ static FillBitsType red_marshall_qxl_draw_opaque(RedChannelClient *rcc,
     SpiceOpaque opaque;
     FillBitsType src_send_type;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_OPAQUE, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_OPAQUE);
     fill_base(base_marshaller, item);
     opaque = drawable->u.opaque;
     spice_marshall_Opaque(base_marshaller,
@@ -995,7 +995,7 @@ static FillBitsType red_marshall_qxl_draw_copy(RedChannelClient *rcc,
     SpiceCopy copy;
     FillBitsType src_send_type;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY);
     fill_base(base_marshaller, item);
     copy = drawable->u.copy;
     spice_marshall_Copy(base_marshaller,
@@ -1044,7 +1044,7 @@ static void red_marshall_qxl_draw_transparent(RedChannelClient *rcc,
     SpiceMarshaller *src_bitmap_out;
     SpiceTransparent transparent;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_TRANSPARENT, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_TRANSPARENT);
     fill_base(base_marshaller, item);
     transparent = drawable->u.transparent;
     spice_marshall_Transparent(base_marshaller,
@@ -1092,7 +1092,7 @@ static FillBitsType red_marshall_qxl_draw_alpha_blend(RedChannelClient *rcc,
     SpiceAlphaBlend alpha_blend;
     FillBitsType src_send_type;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND);
     fill_base(base_marshaller, item);
     alpha_blend = drawable->u.alpha_blend;
     spice_marshall_AlphaBlend(base_marshaller,
@@ -1139,7 +1139,7 @@ static void red_marshall_qxl_copy_bits(RedChannelClient *rcc,
     RedDrawable *drawable = item->red_drawable;
     SpicePoint copy_bits;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_COPY_BITS, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_COPY_BITS);
     fill_base(base_marshaller, item);
     copy_bits = drawable->u.copy_bits.src_pos;
     spice_marshall_Point(base_marshaller,
@@ -1186,7 +1186,7 @@ static void red_marshall_qxl_draw_blend(RedChannelClient *rcc,
     SpiceMarshaller *mask_bitmap_out;
     SpiceBlend blend;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_BLEND, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_BLEND);
     fill_base(base_marshaller, item);
     blend = drawable->u.blend;
     spice_marshall_Blend(base_marshaller,
@@ -1250,7 +1250,7 @@ static void red_marshall_qxl_draw_blackness(RedChannelClient *rcc,
     SpiceMarshaller *mask_bitmap_out;
     SpiceBlackness blackness;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_BLACKNESS, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_BLACKNESS);
     fill_base(base_marshaller, item);
     blackness = drawable->u.blackness;
 
@@ -1284,7 +1284,7 @@ static void red_marshall_qxl_draw_whiteness(RedChannelClient *rcc,
     SpiceMarshaller *mask_bitmap_out;
     SpiceWhiteness whiteness;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_WHITENESS, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_WHITENESS);
     fill_base(base_marshaller, item);
     whiteness = drawable->u.whiteness;
 
@@ -1317,7 +1317,7 @@ static void red_marshall_qxl_draw_inverse(RedChannelClient *rcc,
     SpiceMarshaller *mask_bitmap_out;
     SpiceInvers inverse;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_INVERS, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_INVERS);
     fill_base(base_marshaller, item);
     inverse = drawable->u.invers;
 
@@ -1347,7 +1347,7 @@ static void red_marshall_qxl_draw_rop3(RedChannelClient *rcc,
     SpiceMarshaller *brush_pat_out;
     SpiceMarshaller *mask_bitmap_out;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_ROP3, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_ROP3);
     fill_base(base_marshaller, item);
     rop3 = drawable->u.rop3;
     spice_marshall_Rop3(base_marshaller,
@@ -1430,7 +1430,7 @@ static void red_marshall_qxl_draw_composite(RedChannelClient *rcc,
     SpiceMarshaller *mask_bitmap_out;
     SpiceComposite composite;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COMPOSITE, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COMPOSITE);
     fill_base(base_marshaller, item);
     composite = drawable->u.composite;
     spice_marshall_Composite(base_marshaller,
@@ -1511,7 +1511,7 @@ static void red_marshall_qxl_draw_stroke(RedChannelClient *rcc,
     SpiceMarshaller *brush_pat_out;
     SpiceMarshaller *style_out;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_STROKE, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_STROKE);
     fill_base(base_marshaller, item);
     stroke = drawable->u.stroke;
     spice_marshall_Stroke(base_marshaller,
@@ -1591,7 +1591,7 @@ static void red_marshall_qxl_draw_text(RedChannelClient *rcc,
     SpiceMarshaller *brush_pat_out;
     SpiceMarshaller *back_brush_pat_out;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_TEXT, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_TEXT);
     fill_base(base_marshaller, item);
     text = drawable->u.text;
     spice_marshall_Text(base_marshaller,
@@ -1739,7 +1739,7 @@ static int red_marshall_stream_data(RedChannelClient *rcc,
     if (!is_sized) {
         SpiceMsgDisplayStreamData stream_data;
 
-        red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_DATA, NULL);
+        red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_DATA);
 
         stream_data.base.id = display_channel_get_stream_id(display, stream);
         stream_data.base.multi_media_time = frame_mm_time;
@@ -1749,7 +1749,7 @@ static int red_marshall_stream_data(RedChannelClient *rcc,
     } else {
         SpiceMsgDisplayStreamDataSized stream_data;
 
-        red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_DATA_SIZED, NULL);
+        red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_DATA_SIZED);
 
         stream_data.base.id = display_channel_get_stream_id(display, stream);
         stream_data.base.multi_media_time = frame_mm_time;
@@ -1779,7 +1779,7 @@ static inline void marshall_inval_palette(RedChannelClient *rcc,
 {
     SpiceMsgDisplayInvalOne inval_one;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_PALETTE, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_PALETTE);
     inval_one.id = cache_item->id;
 
     spice_marshall_msg_display_inval_palette(base_marshaller, &inval_one);
@@ -1826,7 +1826,7 @@ static void display_channel_marshall_migrate_data(RedChannelClient *rcc,
 
     display_channel = DISPLAY_CHANNEL(red_channel_client_get_channel(rcc));
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA);
     spice_marshaller_add_uint32(base_marshaller, SPICE_MIGRATE_DATA_DISPLAY_MAGIC);
     spice_marshaller_add_uint32(base_marshaller, SPICE_MIGRATE_DATA_DISPLAY_VERSION);
 
@@ -1860,7 +1860,7 @@ static void display_channel_marshall_pixmap_sync(RedChannelClient *rcc,
     SpiceMsgWaitForChannels wait;
     PixmapCache *pixmap_cache;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_WAIT_FOR_CHANNELS, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_WAIT_FOR_CHANNELS);
     pixmap_cache = dcc->priv->pixmap_cache;
 
     pthread_mutex_lock(&pixmap_cache->lock);
@@ -1911,7 +1911,7 @@ static void display_channel_marshall_reset_cache(RedChannelClient *rcc,
     DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
     SpiceMsgWaitForChannels wait;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS);
     dcc_pixmap_cache_reset(dcc, &wait);
 
     spice_marshall_msg_display_inval_all_pixmaps(base_marshaller,
@@ -1954,7 +1954,7 @@ static void red_marshall_image(RedChannelClient *rcc,
     chunks = spice_chunks_new_linear(item->data, bitmap.stride * bitmap.y);
     bitmap.data = chunks;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY);
 
     copy.base.surface_id = item->surface_id;
     copy.base.box.left = item->pos.x;
@@ -2154,7 +2154,7 @@ static void marshall_stream_start(RedChannelClient *rcc,
         /* Without a video encoder nothing will be streamed */
         return;
     }
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_CREATE, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_CREATE);
     SpiceMsgDisplayStreamCreate stream_create;
     SpiceClipRects clip_rects;
 
@@ -2192,7 +2192,7 @@ static void marshall_stream_clip(RedChannelClient *rcc,
 
     spice_return_if_fail(agent->stream);
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_CLIP, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_CLIP);
     SpiceMsgDisplayStreamClip stream_clip;
 
     stream_clip.id = display_channel_get_stream_id(DCC_TO_DC(dcc), agent->stream);
@@ -2208,7 +2208,7 @@ static void marshall_stream_end(RedChannelClient *rcc,
     DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
     SpiceMsgDisplayStreamDestroy destroy;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_DESTROY, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_DESTROY);
     destroy.id = display_channel_get_stream_id(DCC_TO_DC(dcc), agent->stream);
     stream_agent_stop(agent);
     spice_marshall_msg_display_stream_destroy(base_marshaller, &destroy);
@@ -2224,7 +2224,7 @@ static void marshall_upgrade(RedChannelClient *rcc, SpiceMarshaller *m,
     SpiceMarshaller *src_bitmap_out, *mask_bitmap_out;
 
     spice_assert(channel && item && item->drawable);
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY);
 
     red_drawable = item->drawable->red_drawable;
     spice_assert(red_drawable->type == QXL_DRAW_COPY);
@@ -2250,7 +2250,7 @@ static void marshall_surface_create(RedChannelClient *rcc,
     DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
 
     region_init(&dcc->priv->surface_client_lossy_region[surface_create->surface_id]);
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_SURFACE_CREATE, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_SURFACE_CREATE);
 
     spice_marshall_msg_display_surface_create(base_marshaller, surface_create);
 }
@@ -2262,7 +2262,7 @@ static void marshall_surface_destroy(RedChannelClient *rcc,
     SpiceMsgSurfaceDestroy surface_destroy;
 
     region_destroy(&dcc->priv->surface_client_lossy_region[surface_id]);
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_SURFACE_DESTROY, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_SURFACE_DESTROY);
 
     surface_destroy.surface_id = surface_id;
 
@@ -2277,7 +2277,7 @@ static void marshall_monitors_config(RedChannelClient *rcc, SpiceMarshaller *bas
     SpiceMsgDisplayMonitorsConfig *msg = spice_malloc0(sizeof(*msg) + heads_size);
     int count = 0; // ignore monitors_config->count, it may contain zero width monitors, remove them now
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_MONITORS_CONFIG, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_MONITORS_CONFIG);
     for (i = 0 ; i < monitors_config->count; ++i) {
         if (monitors_config->heads[i].width == 0 || monitors_config->heads[i].height == 0) {
             continue;
@@ -2304,7 +2304,7 @@ static void marshall_stream_activate_report(RedChannelClient *rcc,
     StreamAgent *agent = &dcc->priv->stream_agents[stream_id];
     SpiceMsgDisplayStreamActivateReport msg;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT);
     msg.stream_id = stream_id;
     msg.unique_id = agent->report_id;
     msg.max_window_size = RED_STREAM_CLIENT_REPORT_WINDOW;
@@ -2322,7 +2322,7 @@ static void marshall_gl_scanout(RedChannelClient *rcc,
 
     SpiceMsgDisplayGlScanoutUnix *scanout = red_qxl_get_gl_scanout(qxl);
     if (scanout != NULL) {
-        red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_GL_SCANOUT_UNIX, NULL);
+        red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_GL_SCANOUT_UNIX);
         spice_marshall_msg_display_gl_scanout_unix(m, scanout);
     }
     red_qxl_put_gl_scanout(qxl, scanout);
@@ -2334,7 +2334,7 @@ static void marshall_gl_draw(RedChannelClient *rcc,
 {
     RedGlDrawItem *p = SPICE_UPCAST(RedGlDrawItem, item);
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_GL_DRAW, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_GL_DRAW);
     spice_marshall_msg_display_gl_draw(m, &p->draw);
 }
 
@@ -2419,7 +2419,7 @@ void dcc_send_item(RedChannelClient *rcc, RedPipeItem *pipe_item)
         break;
     case RED_PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE:
         dcc_palette_cache_reset(dcc);
-        red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES, NULL);
+        red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES);
         break;
     case RED_PIPE_ITEM_TYPE_CREATE_SURFACE: {
         RedSurfaceCreateItem *surface_create = SPICE_CONTAINEROF(pipe_item, RedSurfaceCreateItem,
diff --git a/server/inputs-channel-client.c b/server/inputs-channel-client.c
index 0200ecd..4a534e8 100644
--- a/server/inputs-channel-client.c
+++ b/server/inputs-channel-client.c
@@ -89,7 +89,7 @@ void inputs_channel_client_send_migrate_data(RedChannelClient *rcc,
 {
     InputsChannelClient *icc = INPUTS_CHANNEL_CLIENT(rcc);
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA);
 
     spice_marshaller_add_uint32(m, SPICE_MIGRATE_DATA_INPUTS_MAGIC);
     spice_marshaller_add_uint32(m, SPICE_MIGRATE_DATA_INPUTS_VERSION);
diff --git a/server/inputs-channel.c b/server/inputs-channel.c
index f628f48..f105b4d 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -249,7 +249,7 @@ static void inputs_channel_send_item(RedChannelClient *rcc, RedPipeItem *base)
         {
             SpiceMsgInputsKeyModifiers key_modifiers;
 
-            red_channel_client_init_send_data(rcc, SPICE_MSG_INPUTS_KEY_MODIFIERS, NULL);
+            red_channel_client_init_send_data(rcc, SPICE_MSG_INPUTS_KEY_MODIFIERS);
             key_modifiers.modifiers =
                 SPICE_UPCAST(RedKeyModifiersPipeItem, base)->modifiers;
             spice_marshall_msg_inputs_key_modifiers(m, &key_modifiers);
@@ -259,14 +259,14 @@ static void inputs_channel_send_item(RedChannelClient *rcc, RedPipeItem *base)
         {
             SpiceMsgInputsInit inputs_init;
 
-            red_channel_client_init_send_data(rcc, SPICE_MSG_INPUTS_INIT, NULL);
+            red_channel_client_init_send_data(rcc, SPICE_MSG_INPUTS_INIT);
             inputs_init.keyboard_modifiers =
                 SPICE_UPCAST(RedInputsInitPipeItem, base)->modifiers;
             spice_marshall_msg_inputs_init(m, &inputs_init);
             break;
         }
         case RED_PIPE_ITEM_MOUSE_MOTION_ACK:
-            red_channel_client_init_send_data(rcc, SPICE_MSG_INPUTS_MOUSE_MOTION_ACK, NULL);
+            red_channel_client_init_send_data(rcc, SPICE_MSG_INPUTS_MOUSE_MOTION_ACK);
             break;
         case RED_PIPE_ITEM_MIGRATE_DATA:
             INPUTS_CHANNEL(red_channel_client_get_channel(rcc))->src_during_migrate = FALSE;
diff --git a/server/main-channel-client.c b/server/main-channel-client.c
index a06eb48..94150e6 100644
--- a/server/main-channel-client.c
+++ b/server/main-channel-client.c
@@ -771,7 +771,7 @@ static void main_channel_marshall_channels(RedChannelClient *rcc,
     SpiceMsgChannels* channels_info;
     RedChannel *channel = red_channel_client_get_channel(rcc);
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_CHANNELS_LIST, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_CHANNELS_LIST);
     channels_info = reds_msg_channels_new(red_channel_get_server(channel));
     spice_marshall_msg_main_channels_list(m, channels_info);
     free(channels_info);
@@ -785,7 +785,7 @@ static void main_channel_marshall_ping(RedChannelClient *rcc,
     SpiceMsgPing ping;
     int size_left = item->size;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_PING, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_PING);
     ping.id = main_channel_client_next_ping_id(mcc);
     ping.timestamp = g_get_monotonic_time();
     spice_marshall_msg_ping(m, &ping);
@@ -803,7 +803,7 @@ static void main_channel_marshall_mouse_mode(RedChannelClient *rcc,
 {
     SpiceMsgMainMouseMode mouse_mode;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MOUSE_MODE, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MOUSE_MODE);
     mouse_mode.supported_modes = SPICE_MOUSE_MODE_SERVER;
     if (item->is_client_mouse_allowed) {
         mouse_mode.supported_modes |= SPICE_MOUSE_MODE_CLIENT;
@@ -818,7 +818,7 @@ static void main_channel_marshall_agent_disconnected(RedChannelClient *rcc,
 {
     SpiceMsgMainAgentDisconnect disconnect;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_AGENT_DISCONNECTED, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_AGENT_DISCONNECTED);
     disconnect.error_code = SPICE_LINK_ERR_OK;
     spice_marshall_msg_main_agent_disconnected(m, &disconnect);
 }
@@ -828,7 +828,7 @@ static void main_channel_marshall_tokens(RedChannelClient *rcc,
 {
     SpiceMsgMainAgentTokens tokens;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_AGENT_TOKEN, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_AGENT_TOKEN);
     tokens.num_tokens = item->tokens;
     spice_marshall_msg_main_agent_token(m, &tokens);
 }
@@ -837,7 +837,7 @@ static void main_channel_marshall_agent_data(RedChannelClient *rcc,
                                              SpiceMarshaller *m,
                                              RedAgentDataPipeItem *item)
 {
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_AGENT_DATA, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_AGENT_DATA);
     /* since pipe item owns the data, keep it alive until it's sent */
     red_pipe_item_ref(&item->base);
     spice_marshaller_add_by_ref_full(m, item->data, item->len, marshaller_unref_pipe_item, item);
@@ -848,7 +848,7 @@ static void main_channel_marshall_migrate_data_item(RedChannelClient *rcc,
                                                     RedPipeItem *item)
 {
     RedChannel *channel = red_channel_client_get_channel(rcc);
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA);
     // TODO: from reds split. ugly separation.
     reds_marshall_migrate_data(red_channel_get_server(channel), m);
 }
@@ -860,7 +860,7 @@ static void main_channel_marshall_init(RedChannelClient *rcc,
     SpiceMsgMainInit init; // TODO - remove this copy, make RedInitPipeItem reuse SpiceMsgMainInit
     RedChannel *channel = red_channel_client_get_channel(rcc);
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_INIT, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_INIT);
     init.session_id = item->connection_id;
     init.display_channels_hint = item->display_channels_hint;
     init.current_mouse_mode = item->current_mouse_mode;
@@ -880,7 +880,7 @@ static void main_channel_marshall_notify(RedChannelClient *rcc,
 {
     SpiceMsgNotify notify;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_NOTIFY, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_NOTIFY);
     notify.time_stamp = spice_get_monotonic_time_ns(); // TODO - move to main_new_notify_item
     notify.severity = SPICE_NOTIFY_SEVERITY_WARN;
     notify.visibilty = SPICE_NOTIFY_VISIBILITY_HIGH;
@@ -913,7 +913,7 @@ static void main_channel_marshall_migrate_begin(SpiceMarshaller *m, RedChannelCl
     RedChannel *channel = red_channel_client_get_channel(rcc);
     SpiceMsgMainMigrationBegin migrate;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MIGRATE_BEGIN, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MIGRATE_BEGIN);
     main_channel_fill_migrate_dst_info(MAIN_CHANNEL(channel), &migrate.dst_info);
     spice_marshall_msg_main_migrate_begin(m, &migrate);
 }
@@ -925,7 +925,7 @@ static void main_channel_marshall_migrate_begin_seamless(SpiceMarshaller *m,
     RedChannel *channel = red_channel_client_get_channel(rcc);
     SpiceMsgMainMigrateBeginSeamless migrate_seamless;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MIGRATE_BEGIN_SEAMLESS, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MIGRATE_BEGIN_SEAMLESS);
     main_channel_fill_migrate_dst_info(MAIN_CHANNEL(channel), &migrate_seamless.dst_info);
     migrate_seamless.src_mig_version = SPICE_MIGRATION_PROTOCOL_VERSION;
     spice_marshall_msg_main_migrate_begin_seamless(m, &migrate_seamless);
@@ -937,7 +937,7 @@ static void main_channel_marshall_multi_media_time(RedChannelClient *rcc,
 {
     SpiceMsgMainMultiMediaTime time_mes;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MULTI_MEDIA_TIME, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MULTI_MEDIA_TIME);
     time_mes.time = item->time;
     spice_marshall_msg_main_multi_media_time(m, &time_mes);
 }
@@ -951,7 +951,7 @@ static void main_channel_marshall_migrate_switch(SpiceMarshaller *m, RedChannelC
     const RedsMigSpice *mig_target;
 
     spice_printerr("");
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST);
     main_ch = MAIN_CHANNEL(channel);
     mig_target = main_channel_get_migration_target(main_ch);
     migrate.port = mig_target->port;
@@ -974,7 +974,7 @@ static void main_channel_marshall_agent_connected(SpiceMarshaller *m,
 {
     SpiceMsgMainAgentConnectedTokens connected;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_AGENT_CONNECTED_TOKENS, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_AGENT_CONNECTED_TOKENS);
     connected.num_tokens = REDS_AGENT_WINDOW_SIZE;
     spice_marshall_msg_main_agent_connected_tokens(m, &connected);
 }
@@ -1045,11 +1045,11 @@ void main_channel_client_send_item(RedChannelClient *rcc, RedPipeItem *base)
             main_channel_marshall_migrate_switch(m, rcc, base);
             break;
         case RED_PIPE_ITEM_TYPE_MAIN_NAME:
-            red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_NAME, NULL);
+            red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_NAME);
             spice_marshall_msg_main_name(m, &SPICE_UPCAST(RedNamePipeItem, base)->msg);
             break;
         case RED_PIPE_ITEM_TYPE_MAIN_UUID:
-            red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_UUID, NULL);
+            red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_UUID);
             spice_marshall_msg_main_uuid(m, &SPICE_UPCAST(RedUuidPipeItem, base)->msg);
             break;
         case RED_PIPE_ITEM_TYPE_MAIN_AGENT_CONNECTED_TOKENS:
diff --git a/server/red-channel-client-private.h b/server/red-channel-client-private.h
index 0cb3ddd..593fee5 100644
--- a/server/red-channel-client-private.h
+++ b/server/red-channel-client-private.h
@@ -69,14 +69,12 @@ struct RedChannelClientPrivate
         SpiceMarshaller *marshaller;
         SpiceDataHeaderOpaque header;
         uint32_t size;
-        RedPipeItem *item;
         int blocked;
         uint64_t last_sent_serial;
 
         struct {
             SpiceMarshaller *marshaller;
             uint8_t *header_data;
-            RedPipeItem *item;
         } main;
 
         struct {
diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index a69146a..8312d3e 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -444,7 +444,7 @@ static void red_channel_client_send_set_ack(RedChannelClient *rcc)
     SpiceMsgSetAck ack;
 
     spice_assert(rcc);
-    red_channel_client_init_send_data(rcc, SPICE_MSG_SET_ACK, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_SET_ACK);
     ack.generation = ++rcc->priv->ack_data.generation;
     ack.window = rcc->priv->ack_data.client_window;
     rcc->priv->ack_data.messages_window = 0;
@@ -458,7 +458,7 @@ static void red_channel_client_send_migrate(RedChannelClient *rcc)
 {
     SpiceMsgMigrate migrate;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE);
     g_object_get(rcc->priv->channel, "migration-flags", &migrate.flags, NULL);
     spice_marshall_msg_migrate(rcc->priv->send_data.marshaller, &migrate);
     if (migrate.flags & SPICE_MIGRATE_NEED_FLUSH) {
@@ -500,7 +500,7 @@ static void red_channel_client_send_ping(RedChannelClient *rcc)
         }
     }
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_PING, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_PING);
     ping.id = rcc->priv->latency_monitor.id;
     ping.timestamp = spice_get_monotonic_time_ns();
     spice_marshall_msg_ping(rcc->priv->send_data.marshaller, &ping);
@@ -511,7 +511,7 @@ static void red_channel_client_send_empty_msg(RedChannelClient *rcc, RedPipeItem
 {
     RedEmptyMsgPipeItem *msg_pipe_item = SPICE_UPCAST(RedEmptyMsgPipeItem, base);
 
-    red_channel_client_init_send_data(rcc, msg_pipe_item->msg, NULL);
+    red_channel_client_init_send_data(rcc, msg_pipe_item->msg);
     red_channel_client_begin_send_message(rcc);
 }
 
@@ -541,19 +541,10 @@ static void red_channel_client_send_item(RedChannelClient *rcc, RedPipeItem *ite
     red_pipe_item_unref(item);
 }
 
-static inline void red_channel_client_release_sent_item(RedChannelClient *rcc)
-{
-    if (rcc->priv->send_data.item) {
-        red_pipe_item_unref(rcc->priv->send_data.item);
-        rcc->priv->send_data.item = NULL;
-    }
-}
-
 static void red_channel_client_restore_main_sender(RedChannelClient *rcc)
 {
     rcc->priv->send_data.marshaller = rcc->priv->send_data.main.marshaller;
     rcc->priv->send_data.header.data = rcc->priv->send_data.main.header_data;
-    rcc->priv->send_data.item = rcc->priv->send_data.main.item;
 }
 
 void red_channel_client_on_out_msg_done(void *opaque)
@@ -1391,15 +1382,11 @@ int red_channel_client_handle_message(RedChannelClient *rcc, uint32_t size,
     return TRUE;
 }
 
-void red_channel_client_init_send_data(RedChannelClient *rcc, uint16_t msg_type, RedPipeItem *item)
+void red_channel_client_init_send_data(RedChannelClient *rcc, uint16_t msg_type)
 {
     spice_assert(red_channel_client_no_item_being_sent(rcc));
     spice_assert(msg_type != 0);
     rcc->priv->send_data.header.set_msg_type(&rcc->priv->send_data.header, msg_type);
-    rcc->priv->send_data.item = item;
-    if (item) {
-        red_pipe_item_ref(item);
-    }
 }
 
 void red_channel_client_begin_send_message(RedChannelClient *rcc)
@@ -1432,10 +1419,8 @@ SpiceMarshaller *red_channel_client_switch_to_urgent_sender(RedChannelClient *rc
     spice_assert(red_channel_client_no_item_being_sent(rcc));
     spice_assert(rcc->priv->send_data.header.data != NULL);
     rcc->priv->send_data.main.header_data = rcc->priv->send_data.header.data;
-    rcc->priv->send_data.main.item = rcc->priv->send_data.item;
 
     rcc->priv->send_data.marshaller = rcc->priv->send_data.urgent.marshaller;
-    rcc->priv->send_data.item = NULL;
     red_channel_client_reset_send_data(rcc);
     return rcc->priv->send_data.marshaller;
 }
@@ -1587,7 +1572,6 @@ gboolean red_channel_client_is_connected(RedChannelClient *rcc)
 
 static void red_channel_client_clear_sent_item(RedChannelClient *rcc)
 {
-    red_channel_client_release_sent_item(rcc);
     rcc->priv->send_data.blocked = FALSE;
     rcc->priv->send_data.size = 0;
     spice_marshaller_reset(rcc->priv->send_data.marshaller);
diff --git a/server/red-channel-client.h b/server/red-channel-client.h
index 94b4f58..0d404d1 100644
--- a/server/red-channel-client.h
+++ b/server/red-channel-client.h
@@ -89,7 +89,7 @@ void red_channel_client_shutdown(RedChannelClient *rcc);
 int red_channel_client_handle_message(RedChannelClient *rcc, uint32_t size,
                                       uint16_t type, void *message);
 /* when preparing send_data: should call init and then use marshaller */
-void red_channel_client_init_send_data(RedChannelClient *rcc, uint16_t msg_type, RedPipeItem *item);
+void red_channel_client_init_send_data(RedChannelClient *rcc, uint16_t msg_type);
 
 uint64_t red_channel_client_get_message_serial(RedChannelClient *channel);
 void red_channel_client_set_message_serial(RedChannelClient *channel, uint64_t);
diff --git a/server/smartcard-channel-client.c b/server/smartcard-channel-client.c
index 6f39874..668a1fb 100644
--- a/server/smartcard-channel-client.c
+++ b/server/smartcard-channel-client.c
@@ -214,7 +214,7 @@ void smartcard_channel_client_send_data(RedChannelClient *rcc,
     /* NOTE: 'vheader' is assumed to be owned by 'item' so we keep the pipe
      * item valid until the message is actually sent. */
     red_pipe_item_ref(item);
-    red_channel_client_init_send_data(rcc, SPICE_MSG_SMARTCARD_DATA, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_SMARTCARD_DATA);
     spice_marshaller_add_by_ref_full(m, (uint8_t*)vheader, sizeof(VSCMsgHeader) + vheader->length,
                                      marshaller_unref_pipe_item, item);
 }
diff --git a/server/smartcard.c b/server/smartcard.c
index 9e0d968..f4bc40d 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -419,7 +419,7 @@ static void smartcard_channel_send_migrate_data(RedChannelClient *rcc,
 
     scc = SMARTCARD_CHANNEL_CLIENT(rcc);
     dev = smartcard_channel_client_get_char_device(scc);
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA);
     spice_marshaller_add_uint32(m, SPICE_MIGRATE_DATA_SMARTCARD_MAGIC);
     spice_marshaller_add_uint32(m, SPICE_MIGRATE_DATA_SMARTCARD_VERSION);
 
diff --git a/server/spicevmc.c b/server/spicevmc.c
index d5e398b..bbe72b5 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -635,10 +635,10 @@ static void spicevmc_red_channel_send_data(RedChannelClient *rcc,
 
     /* for compatibility send using not compressed data message */
     if (i->type == SPICE_DATA_COMPRESSION_TYPE_NONE) {
-        red_channel_client_init_send_data(rcc, SPICE_MSG_SPICEVMC_DATA, NULL);
+        red_channel_client_init_send_data(rcc, SPICE_MSG_SPICEVMC_DATA);
     } else {
         /* send as compressed */
-        red_channel_client_init_send_data(rcc, SPICE_MSG_SPICEVMC_COMPRESSED_DATA, NULL);
+        red_channel_client_init_send_data(rcc, SPICE_MSG_SPICEVMC_COMPRESSED_DATA);
         SpiceMsgCompressedData compressed_msg = {
             .type = i->type,
             .uncompressed_size = i->uncompressed_data_size
@@ -657,7 +657,7 @@ static void spicevmc_red_channel_send_migrate_data(RedChannelClient *rcc,
     RedVmcChannel *channel;
 
     channel = RED_VMC_CHANNEL(red_channel_client_get_channel(rcc));
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA);
     spice_marshaller_add_uint32(m, SPICE_MIGRATE_DATA_SPICEVMC_MAGIC);
     spice_marshaller_add_uint32(m, SPICE_MIGRATE_DATA_SPICEVMC_VERSION);
 
@@ -671,7 +671,7 @@ static void spicevmc_red_channel_send_port_init(RedChannelClient *rcc,
     RedPortInitPipeItem *i = SPICE_UPCAST(RedPortInitPipeItem, item);
     SpiceMsgPortInit init;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_PORT_INIT, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_PORT_INIT);
     init.name = (uint8_t *)i->name;
     init.name_size = strlen(i->name) + 1;
     init.opened = i->opened;
@@ -685,7 +685,7 @@ static void spicevmc_red_channel_send_port_event(RedChannelClient *rcc,
     RedPortEventPipeItem *i = SPICE_UPCAST(RedPortEventPipeItem, item);
     SpiceMsgPortEvent event;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_PORT_EVENT, NULL);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_PORT_EVENT);
     event.event = i->event;
     spice_marshall_msg_port_event(m, &event);
 }
commit a43c21b6bcdda701763afb6d73e38a3c419e54c7
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Tue Dec 20 09:59:50 2016 -0600

    DCC: change how fill_bits() marshalls data by reference
    
    The fill_bits() function marshalls some data by reference. This data is
    owned by the RedDrawable that is owned by the Drawable that is owned by
    the RedDrawablePipeItem.  Instead of keeping the RedPipeItem alive by
    passing it to red_channel_client_init_send_data(), simply reference the
    Drawable and marshall it with _add_by_ref_full(). This means that we
    can't use  the _add_chunks_by_ref() convenience function since that
    function doesn't allow us to pass a free function to clean up the data
    after it is sent.
    
    This change is not perfect since the fill_bits() function makes an
    assumption that 'simage' is owned by the 'drawable'. On the other hand,
    the previous code made a much bigger assumption: that the caller would
    ensure that the data would be kept alive
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/dcc-send.c b/server/dcc-send.c
index 09eb21b..b6afefb 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -343,8 +343,17 @@ static void marshaller_add_compressed(SpiceMarshaller *m,
     } while (max);
 }
 
+static void marshaller_unref_drawable(uint8_t *data, void *opaque)
+{
+    Drawable *drawable = opaque;
+    drawable_unref(drawable);
+}
+
 /* if the number of times fill_bits can be called per one qxl_drawable increases -
    MAX_LZ_DRAWABLE_INSTANCES must be increased as well */
+/* NOTE: 'simage' should be owned by the drawable. The drawable will be kept
+ * alive until the marshalled message has been sent. See comments below for
+ * more information */
 static FillBitsType fill_bits(DisplayChannelClient *dcc, SpiceMarshaller *m,
                               SpiceImage *simage, Drawable *drawable, int can_lossy)
 {
@@ -449,7 +458,14 @@ static FillBitsType fill_bits(DisplayChannelClient *dcc, SpiceMarshaller *m,
                 spice_marshall_Palette(bitmap_palette_out, palette);
             }
 
-            spice_marshaller_add_chunks_by_ref(m, bitmap->data);
+            /* 'drawable' owns this bitmap data, so it must be kept
+             * alive until the message is sent. */
+            for (unsigned int i = 0; i < bitmap->data->num_chunks; i++) {
+                drawable->refs++;
+                spice_marshaller_add_by_ref_full(m, bitmap->data->chunk[i].data,
+                                                 bitmap->data->chunk[i].len,
+                                                 marshaller_unref_drawable, drawable);
+            }
             pthread_mutex_unlock(&dcc->priv->pixmap_cache->lock);
             return FILL_BITS_TYPE_BITMAP;
         } else {
@@ -481,7 +497,14 @@ static FillBitsType fill_bits(DisplayChannelClient *dcc, SpiceMarshaller *m,
                              &bitmap_palette_out, &lzplt_palette_out);
         spice_assert(bitmap_palette_out == NULL);
         spice_assert(lzplt_palette_out == NULL);
-        spice_marshaller_add_chunks_by_ref(m, image.u.quic.data);
+        /* 'drawable' owns this image data, so it must be kept
+         * alive until the message is sent. */
+        for (unsigned int i = 0; i < image.u.quic.data->num_chunks; i++) {
+            drawable->refs++;
+            spice_marshaller_add_by_ref_full(m, image.u.quic.data->chunk[i].data,
+                                             image.u.quic.data->chunk[i].len,
+                                             marshaller_unref_drawable, drawable);
+        }
         pthread_mutex_unlock(&dcc->priv->pixmap_cache->lock);
         return FILL_BITS_TYPE_COMPRESS_LOSSLESS;
     default:
@@ -531,7 +554,7 @@ static void marshall_qxl_draw_fill(RedChannelClient *rcc,
     SpiceMarshaller *mask_bitmap_out;
     SpiceFill fill;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_FILL, &dpi->dpi_pipe_item);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_FILL, NULL);
     fill_base(base_marshaller, item);
     fill = drawable->u.fill;
     spice_marshall_Fill(base_marshaller,
@@ -875,7 +898,7 @@ static FillBitsType red_marshall_qxl_draw_opaque(RedChannelClient *rcc,
     SpiceOpaque opaque;
     FillBitsType src_send_type;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_OPAQUE, &dpi->dpi_pipe_item);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_OPAQUE, NULL);
     fill_base(base_marshaller, item);
     opaque = drawable->u.opaque;
     spice_marshall_Opaque(base_marshaller,
@@ -972,7 +995,7 @@ static FillBitsType red_marshall_qxl_draw_copy(RedChannelClient *rcc,
     SpiceCopy copy;
     FillBitsType src_send_type;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY, &dpi->dpi_pipe_item);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY, NULL);
     fill_base(base_marshaller, item);
     copy = drawable->u.copy;
     spice_marshall_Copy(base_marshaller,
@@ -1021,8 +1044,7 @@ static void red_marshall_qxl_draw_transparent(RedChannelClient *rcc,
     SpiceMarshaller *src_bitmap_out;
     SpiceTransparent transparent;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_TRANSPARENT,
-                                      &dpi->dpi_pipe_item);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_TRANSPARENT, NULL);
     fill_base(base_marshaller, item);
     transparent = drawable->u.transparent;
     spice_marshall_Transparent(base_marshaller,
@@ -1070,8 +1092,7 @@ static FillBitsType red_marshall_qxl_draw_alpha_blend(RedChannelClient *rcc,
     SpiceAlphaBlend alpha_blend;
     FillBitsType src_send_type;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND,
-                                      &dpi->dpi_pipe_item);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND, NULL);
     fill_base(base_marshaller, item);
     alpha_blend = drawable->u.alpha_blend;
     spice_marshall_AlphaBlend(base_marshaller,
@@ -1165,7 +1186,7 @@ static void red_marshall_qxl_draw_blend(RedChannelClient *rcc,
     SpiceMarshaller *mask_bitmap_out;
     SpiceBlend blend;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_BLEND, &dpi->dpi_pipe_item);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_BLEND, NULL);
     fill_base(base_marshaller, item);
     blend = drawable->u.blend;
     spice_marshall_Blend(base_marshaller,
@@ -1229,7 +1250,7 @@ static void red_marshall_qxl_draw_blackness(RedChannelClient *rcc,
     SpiceMarshaller *mask_bitmap_out;
     SpiceBlackness blackness;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_BLACKNESS, &dpi->dpi_pipe_item);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_BLACKNESS, NULL);
     fill_base(base_marshaller, item);
     blackness = drawable->u.blackness;
 
@@ -1263,7 +1284,7 @@ static void red_marshall_qxl_draw_whiteness(RedChannelClient *rcc,
     SpiceMarshaller *mask_bitmap_out;
     SpiceWhiteness whiteness;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_WHITENESS, &dpi->dpi_pipe_item);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_WHITENESS, NULL);
     fill_base(base_marshaller, item);
     whiteness = drawable->u.whiteness;
 
@@ -1326,7 +1347,7 @@ static void red_marshall_qxl_draw_rop3(RedChannelClient *rcc,
     SpiceMarshaller *brush_pat_out;
     SpiceMarshaller *mask_bitmap_out;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_ROP3, &dpi->dpi_pipe_item);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_ROP3, NULL);
     fill_base(base_marshaller, item);
     rop3 = drawable->u.rop3;
     spice_marshall_Rop3(base_marshaller,
@@ -1409,7 +1430,7 @@ static void red_marshall_qxl_draw_composite(RedChannelClient *rcc,
     SpiceMarshaller *mask_bitmap_out;
     SpiceComposite composite;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COMPOSITE, &dpi->dpi_pipe_item);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COMPOSITE, NULL);
     fill_base(base_marshaller, item);
     composite = drawable->u.composite;
     spice_marshall_Composite(base_marshaller,
@@ -1490,7 +1511,7 @@ static void red_marshall_qxl_draw_stroke(RedChannelClient *rcc,
     SpiceMarshaller *brush_pat_out;
     SpiceMarshaller *style_out;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_STROKE, &dpi->dpi_pipe_item);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_STROKE, NULL);
     fill_base(base_marshaller, item);
     stroke = drawable->u.stroke;
     spice_marshall_Stroke(base_marshaller,
@@ -1570,7 +1591,7 @@ static void red_marshall_qxl_draw_text(RedChannelClient *rcc,
     SpiceMarshaller *brush_pat_out;
     SpiceMarshaller *back_brush_pat_out;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_TEXT, &dpi->dpi_pipe_item);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_TEXT, NULL);
     fill_base(base_marshaller, item);
     text = drawable->u.text;
     spice_marshall_Text(base_marshaller,
@@ -2203,7 +2224,7 @@ static void marshall_upgrade(RedChannelClient *rcc, SpiceMarshaller *m,
     SpiceMarshaller *src_bitmap_out, *mask_bitmap_out;
 
     spice_assert(channel && item && item->drawable);
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY, &item->base);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY, NULL);
 
     red_drawable = item->drawable->red_drawable;
     spice_assert(red_drawable->type == QXL_DRAW_COPY);
commit 3bde2e570cbfd4f29a2e94c14ff28b6e3987048d
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Tue Dec 20 09:59:49 2016 -0600

    DCC: remove more init_send_data() arguments
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/dcc-send.c b/server/dcc-send.c
index edeea62..09eb21b 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -1118,7 +1118,7 @@ static void red_marshall_qxl_copy_bits(RedChannelClient *rcc,
     RedDrawable *drawable = item->red_drawable;
     SpicePoint copy_bits;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_COPY_BITS, &dpi->dpi_pipe_item);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_COPY_BITS, NULL);
     fill_base(base_marshaller, item);
     copy_bits = drawable->u.copy_bits.src_pos;
     spice_marshall_Point(base_marshaller,
@@ -1933,7 +1933,7 @@ static void red_marshall_image(RedChannelClient *rcc,
     chunks = spice_chunks_new_linear(item->data, bitmap.stride * bitmap.y);
     bitmap.data = chunks;
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY, &item->base);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY, NULL);
 
     copy.base.surface_id = item->surface_id;
     copy.base.box.left = item->pos.x;
@@ -1984,8 +1984,9 @@ static void red_marshall_image(RedChannelClient *rcc,
 
         spice_marshall_Image(src_bitmap_out, &red_image,
                              &bitmap_palette_out, &lzplt_palette_out);
-        spice_marshaller_add_by_ref(src_bitmap_out, item->data,
-                                    bitmap.y * bitmap.stride);
+        spice_marshaller_add_by_ref_full(src_bitmap_out, item->data,
+                                         bitmap.y * bitmap.stride,
+                                         marshaller_unref_pipe_item, item);
         region_remove(surface_lossy_region, &copy.base.box);
     }
     spice_chunks_destroy(chunks);
@@ -2170,7 +2171,7 @@ static void marshall_stream_clip(RedChannelClient *rcc,
 
     spice_return_if_fail(agent->stream);
 
-    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_CLIP, &item->base);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_CLIP, NULL);
     SpiceMsgDisplayStreamClip stream_clip;
 
     stream_clip.id = display_channel_get_stream_id(DCC_TO_DC(dcc), agent->stream);
commit b5758229ad69f2e5b51d80c8616ed8d9abbbe8d6
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Tue Dec 20 09:59:48 2016 -0600

    Spicevmc: don't pass pipe item to init_send_data()
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/spicevmc.c b/server/spicevmc.c
index a85c80a..d5e398b 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -635,17 +635,19 @@ static void spicevmc_red_channel_send_data(RedChannelClient *rcc,
 
     /* for compatibility send using not compressed data message */
     if (i->type == SPICE_DATA_COMPRESSION_TYPE_NONE) {
-        red_channel_client_init_send_data(rcc, SPICE_MSG_SPICEVMC_DATA, item);
+        red_channel_client_init_send_data(rcc, SPICE_MSG_SPICEVMC_DATA, NULL);
     } else {
         /* send as compressed */
-        red_channel_client_init_send_data(rcc, SPICE_MSG_SPICEVMC_COMPRESSED_DATA, item);
+        red_channel_client_init_send_data(rcc, SPICE_MSG_SPICEVMC_COMPRESSED_DATA, NULL);
         SpiceMsgCompressedData compressed_msg = {
             .type = i->type,
             .uncompressed_size = i->uncompressed_data_size
         };
         spice_marshall_SpiceMsgCompressedData(m, &compressed_msg);
     }
-    spice_marshaller_add_by_ref(m, i->buf, i->buf_used);
+    red_pipe_item_ref(item);
+    spice_marshaller_add_by_ref_full(m, i->buf, i->buf_used,
+                                     marshaller_unref_pipe_item, item);
 }
 
 static void spicevmc_red_channel_send_migrate_data(RedChannelClient *rcc,
commit 9971c1eda046d038190294dba68e33184aa5ade6
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Tue Dec 20 09:59:47 2016 -0600

    Smartcard: Don't pass pipe item to _init_send_data()
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/smartcard-channel-client.c b/server/smartcard-channel-client.c
index 347e177..6f39874 100644
--- a/server/smartcard-channel-client.c
+++ b/server/smartcard-channel-client.c
@@ -211,8 +211,12 @@ void smartcard_channel_client_send_data(RedChannelClient *rcc,
 {
     spice_assert(rcc);
     spice_assert(vheader);
-    red_channel_client_init_send_data(rcc, SPICE_MSG_SMARTCARD_DATA, item);
-    spice_marshaller_add_by_ref(m, (uint8_t*)vheader, sizeof(VSCMsgHeader) + vheader->length);
+    /* NOTE: 'vheader' is assumed to be owned by 'item' so we keep the pipe
+     * item valid until the message is actually sent. */
+    red_pipe_item_ref(item);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_SMARTCARD_DATA, NULL);
+    spice_marshaller_add_by_ref_full(m, (uint8_t*)vheader, sizeof(VSCMsgHeader) + vheader->length,
+                                     marshaller_unref_pipe_item, item);
 }
 
 void smartcard_channel_client_send_error(RedChannelClient *rcc, SpiceMarshaller *m, RedPipeItem *item)
commit 825880d9198bbf9e59402b88c44321d0103792ae
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Tue Dec 20 09:59:46 2016 -0600

    MainChannel: remove another init_send_data arg
    
    Use spice_marshaller_add_by_ref_full() instead of _add_by_ref() to
    handle the referenced data properly rather than passing the pipe item to
    red_channel_client_init_send_data() to keep the pipe item alive
    indirectly.
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/main-channel-client.c b/server/main-channel-client.c
index 7e55b24..a06eb48 100644
--- a/server/main-channel-client.c
+++ b/server/main-channel-client.c
@@ -837,8 +837,10 @@ static void main_channel_marshall_agent_data(RedChannelClient *rcc,
                                              SpiceMarshaller *m,
                                              RedAgentDataPipeItem *item)
 {
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_AGENT_DATA, &item->base);
-    spice_marshaller_add_by_ref(m, item->data, item->len);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_AGENT_DATA, NULL);
+    /* since pipe item owns the data, keep it alive until it's sent */
+    red_pipe_item_ref(&item->base);
+    spice_marshaller_add_by_ref_full(m, item->data, item->len, marshaller_unref_pipe_item, item);
 }
 
 static void main_channel_marshall_migrate_data_item(RedChannelClient *rcc,
@@ -846,7 +848,7 @@ static void main_channel_marshall_migrate_data_item(RedChannelClient *rcc,
                                                     RedPipeItem *item)
 {
     RedChannel *channel = red_channel_client_get_channel(rcc);
-    red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA, item);
+    red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA, NULL);
     // TODO: from reds split. ugly separation.
     reds_marshall_migrate_data(red_channel_get_server(channel), m);
 }
diff --git a/server/red-pipe-item.c b/server/red-pipe-item.c
index d899610..2cb5847 100644
--- a/server/red-pipe-item.c
+++ b/server/red-pipe-item.c
@@ -46,3 +46,9 @@ void red_pipe_item_init_full(RedPipeItem *item,
     item->refcount = 1;
     item->free_func = free_func ? free_func : (red_pipe_item_free_t *)free;
 }
+
+void marshaller_unref_pipe_item(uint8_t *data G_GNUC_UNUSED, void *opaque)
+{
+    RedPipeItem *item = opaque;
+    red_pipe_item_unref(item);
+}
diff --git a/server/red-pipe-item.h b/server/red-pipe-item.h
index a589c68..90cc817 100644
--- a/server/red-pipe-item.h
+++ b/server/red-pipe-item.h
@@ -42,4 +42,8 @@ static inline void red_pipe_item_init(RedPipeItem *item, int type)
 {
     red_pipe_item_init_full(item, type, NULL);
 }
+
+/* a convenience function for unreffing a pipe item after it has been sent */
+void marshaller_unref_pipe_item(uint8_t *data, void *opaque);
+
 #endif
commit 333ef51eceddef1d6656625d5cbb270ecbf85321
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Tue Dec 20 09:59:45 2016 -0600

    Refactor cursor marshalling for SET, INIT
    
    Use spice_marshaller_add_by_ref_full() instead of
    spice_marshaller_add_by_ref() to allow the marshaller to manage the
    lifetime of the referenced data buffer rather than having to manage it
    by passing a PipeItem to red_channel_client_init_send_data(). Since the
    data is owned by CursorItem (which is not in fact a RedPipeItem, but is
    owned by a pipe item and is itself refcounted), we take a reference on
    the CursorItem when adding the data buf to the marshaller, and then
    unreference it in the marshaller free func.
    
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 04483af..9af1db2 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -123,23 +123,16 @@ static RedPipeItem *new_cursor_pipe_item(RedChannelClient *rcc, void *data, int
     return &item->base;
 }
 
-typedef struct {
-    void *data;
-    uint32_t size;
-} AddBufInfo;
-
-static void add_buf_from_info(SpiceMarshaller *m, AddBufInfo *info)
+static void marshaller_unref_cursor_item(uint8_t *data, void *opaque)
 {
-    if (info->data) {
-        spice_marshaller_add_by_ref(m, info->data, info->size);
-    }
+    CursorItem *item = opaque;
+    cursor_item_unref(item);
 }
 
 static void cursor_fill(CursorChannelClient *ccc, CursorItem *cursor,
-                        SpiceCursor *red_cursor, AddBufInfo *addbuf)
+                        SpiceCursor *red_cursor, SpiceMarshaller *m)
 {
     RedCursorCmd *cursor_cmd;
-    addbuf->data = NULL;
 
     if (!cursor) {
         red_cursor->flags = SPICE_CURSOR_FLAGS_NONE;
@@ -160,8 +153,10 @@ static void cursor_fill(CursorChannelClient *ccc, CursorItem *cursor,
     }
 
     if (red_cursor->data_size) {
-        addbuf->data = red_cursor->data;
-        addbuf->size = red_cursor->data_size;
+        SpiceMarshaller *m2 = spice_marshaller_get_submarshaller(m);
+        cursor_item_ref(cursor);
+        spice_marshaller_add_by_ref_full(m2, red_cursor->data, red_cursor->data_size,
+                                         marshaller_unref_cursor_item, cursor);
     }
 }
 
@@ -192,7 +187,6 @@ static void red_marshall_cursor_init(CursorChannelClient *ccc, SpiceMarshaller *
     CursorChannel *cursor_channel;
     RedChannelClient *rcc = RED_CHANNEL_CLIENT(ccc);
     SpiceMsgCursorInit msg;
-    AddBufInfo info;
 
     spice_assert(rcc);
     cursor_channel = CURSOR_CHANNEL(red_channel_client_get_channel(rcc));
@@ -203,9 +197,8 @@ static void red_marshall_cursor_init(CursorChannelClient *ccc, SpiceMarshaller *
     msg.trail_length = cursor_channel->cursor_trail_length;
     msg.trail_frequency = cursor_channel->cursor_trail_frequency;
 
-    cursor_fill(ccc, cursor_channel->item, &msg.cursor, &info);
+    cursor_fill(ccc, cursor_channel->item, &msg.cursor, base_marshaller);
     spice_marshall_msg_cursor_init(base_marshaller, &msg);
-    add_buf_from_info(base_marshaller, &info);
 }
 
 static void cursor_marshall(CursorChannelClient *ccc,
@@ -215,7 +208,6 @@ static void cursor_marshall(CursorChannelClient *ccc,
     RedChannelClient *rcc = RED_CHANNEL_CLIENT(ccc);
     CursorChannel *cursor_channel = CURSOR_CHANNEL(red_channel_client_get_channel(rcc));
     CursorItem *item = cursor_pipe_item->cursor_item;
-    RedPipeItem *pipe_item = &cursor_pipe_item->base;
     RedCursorCmd *cmd;
 
     spice_return_if_fail(cursor_channel);
@@ -233,15 +225,13 @@ static void cursor_marshall(CursorChannelClient *ccc,
     case QXL_CURSOR_SET:
         {
             SpiceMsgCursorSet cursor_set;
-            AddBufInfo info;
 
-            red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_SET, pipe_item);
+            red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_SET, NULL);
             cursor_set.position = cmd->u.set.position;
             cursor_set.visible = cursor_channel->cursor_visible;
 
-            cursor_fill(ccc, item, &cursor_set.cursor, &info);
+            cursor_fill(ccc, item, &cursor_set.cursor, m);
             spice_marshall_msg_cursor_set(m, &cursor_set);
-            add_buf_from_info(m, &info);
             break;
         }
     case QXL_CURSOR_HIDE:


More information about the Spice-commits mailing list