> > Since the base class now implements refcounting, there's no need to > re-invent it here. > --- > server/dcc-send.c | 4 ++-- > server/dcc.c | 19 +++++-------------- > server/dcc.h | 3 +-- > server/display-channel.c | 2 +- > 4 files changed, 9 insertions(+), 19 deletions(-) > > diff --git a/server/dcc-send.c b/server/dcc-send.c > index eb866cf..b8d1157 100644 > --- a/server/dcc-send.c > +++ b/server/dcc-send.c > @@ -728,7 +728,7 @@ static void > red_pipe_replace_rendered_drawables_with_images(DisplayChannelClient > > spice_assert(image); > red_channel_client_pipe_remove_and_release(RED_CHANNEL_CLIENT(dcc), > &dpi->dpi_pipe_item); > - pipe_item = &image->link; > + pipe_item = &image->base; > } > } > > @@ -1949,7 +1949,7 @@ static void red_marshall_image(RedChannelClient *rcc, > SpiceMarshaller *m, ImageI > 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->link); > + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY, > &item->base); > > copy.base.surface_id = item->surface_id; > copy.base.box.left = item->pos.x; > diff --git a/server/dcc.c b/server/dcc.c > index c952042..4e450b5 100644 > --- a/server/dcc.c > +++ b/server/dcc.c > @@ -184,9 +184,8 @@ ImageItem > *dcc_add_surface_area_image(DisplayChannelClient *dcc, int surface_id, > > item = (ImageItem *)spice_malloc_n_m(height, stride, sizeof(ImageItem)); > > - pipe_item_init(&item->link, PIPE_ITEM_TYPE_IMAGE); > + pipe_item_init(&item->base, PIPE_ITEM_TYPE_IMAGE); > > - item->refs = 1; > item->surface_id = surface_id; > item->image_format = > spice_bitmap_from_surface_type(surface->context.format); > @@ -214,9 +213,9 @@ ImageItem > *dcc_add_surface_area_image(DisplayChannelClient *dcc, int surface_id, > } > > if (pos) { > - red_channel_client_pipe_add_after(RED_CHANNEL_CLIENT(dcc), > &item->link, pos); > + red_channel_client_pipe_add_after(RED_CHANNEL_CLIENT(dcc), > &item->base, pos); > } else { > - red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &item->link); > + red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &item->base); > } > > return item; > @@ -1591,14 +1590,6 @@ int dcc_handle_migrate_data(DisplayChannelClient *dcc, > uint32_t size, void *mess > return TRUE; > } > > -static void image_item_unref(ImageItem *item) > -{ > - if (--item->refs != 0) > - return; > - > - free(item); > -} > - > static void upgrade_item_unref(DisplayChannel *display, UpgradeItem *item) > { > if (--item->refs != 0) > @@ -1624,7 +1615,7 @@ static void > release_item_after_push(DisplayChannelClient *dcc, PipeItem *item) > upgrade_item_unref(display, (UpgradeItem *)item); > break; > case PIPE_ITEM_TYPE_IMAGE: > - image_item_unref((ImageItem *)item); > + pipe_item_unref(item); > break; > case PIPE_ITEM_TYPE_GL_SCANOUT: > case PIPE_ITEM_TYPE_GL_DRAW: > @@ -1674,7 +1665,7 @@ static void > release_item_before_push(DisplayChannelClient *dcc, PipeItem *item) > upgrade_item_unref(display, (UpgradeItem *)item); > break; > case PIPE_ITEM_TYPE_IMAGE: > - image_item_unref((ImageItem *)item); > + pipe_item_unref(item); > break; > case PIPE_ITEM_TYPE_CREATE_SURFACE: { > SurfaceCreateItem *surface_create = SPICE_CONTAINEROF(item, > SurfaceCreateItem, > diff --git a/server/dcc.h b/server/dcc.h > index 071a9fc..3d7870b 100644 > --- a/server/dcc.h > +++ b/server/dcc.h > @@ -136,8 +136,7 @@ typedef struct GlDrawItem { > } GlDrawItem; > > typedef struct ImageItem { > - PipeItem link; > - int refs; > + PipeItem base; > SpicePoint pos; > int width; > int height; > diff --git a/server/display-channel.c b/server/display-channel.c > index a6d90cf..ac10724 100644 > --- a/server/display-channel.c > +++ b/server/display-channel.c > @@ -1980,7 +1980,7 @@ static void hold_item(RedChannelClient *rcc, PipeItem > *item) > ((UpgradeItem *)item)->refs++; > break; Why not these ? > case PIPE_ITEM_TYPE_IMAGE: > - ((ImageItem *)item)->refs++; > + pipe_item_ref(item); > break; > default: > spice_warn_if_reached(); Frediano _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel