Remove some coupling, we mainly need to store a list of RedGlzDrawables. Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> --- server/dcc-encoders.c | 8 ++++---- server/dcc-encoders.h | 4 ++-- server/display-channel.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c index 47ac38b..c43bbb0 100644 --- a/server/dcc-encoders.c +++ b/server/dcc-encoders.c @@ -614,20 +614,20 @@ void image_encoders_free_glz_drawables(ImageEncoders *enc) pthread_rwlock_unlock(&glz_dict->encode_lock); } -void image_encoders_glz_free_from_drawable(struct Drawable *drawable) +void image_encoders_glz_free_from_drawable_ring(Ring *drawable_ring) { RingItem *glz_item, *next_item; RedGlzDrawable *glz; - DRAWABLE_FOREACH_GLZ_SAFE(drawable, glz_item, next_item, glz) { + SAFE_FOREACH(glz_item, next_item, TRUE, drawable_ring, glz, LINK_TO_GLZ(glz_item)) { image_encoders_free_glz_drawable(glz->encoders, glz); } } -void image_encoders_glz_detach_from_drawable(struct Drawable *drawable) +void image_encoders_glz_detach_from_drawable_ring(Ring *drawable_ring) { RingItem *item, *next; - RING_FOREACH_SAFE(item, next, &drawable->glz_ring) { + RING_FOREACH_SAFE(item, next, drawable_ring) { SPICE_CONTAINEROF(item, RedGlzDrawable, drawable_link)->has_drawable = FALSE; ring_remove(item); } diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h index 97f6200..cbbd00d 100644 --- a/server/dcc-encoders.h +++ b/server/dcc-encoders.h @@ -46,8 +46,8 @@ int image_encoders_free_some_independent_glz_drawables(ImageEncoders *enc); void image_encoders_free_glz_drawables(ImageEncoders *enc); void image_encoders_free_glz_drawables_to_free(ImageEncoders* enc); gboolean image_encoders_glz_create(ImageEncoders *enc, uint8_t id); -void image_encoders_glz_free_from_drawable(struct Drawable *drawable); -void image_encoders_glz_detach_from_drawable(struct Drawable *drawable); +void image_encoders_glz_free_from_drawable_ring(Ring *drawable_ring); +void image_encoders_glz_detach_from_drawable_ring(Ring *drawable_ring); void image_encoders_glz_get_restore_data(ImageEncoders *enc, uint8_t *out_id, GlzEncDictRestoreData *out_data); diff --git a/server/display-channel.c b/server/display-channel.c index 5865e56..a5a3254 100644 --- a/server/display-channel.c +++ b/server/display-channel.c @@ -1171,7 +1171,7 @@ static bool free_one_drawable(DisplayChannel *display, int force_glz_free) drawable = SPICE_CONTAINEROF(ring_item, Drawable, list_link); if (force_glz_free) { - image_encoders_glz_free_from_drawable(drawable); + image_encoders_glz_free_from_drawable_ring(&drawable->glz_ring); } drawable_draw(display, drawable); container = drawable->tree_item.base.container; @@ -1340,7 +1340,7 @@ void drawable_unref(Drawable *drawable) drawable_unref_surface_deps(display, drawable); display_channel_surface_unref(display, drawable->surface_id); - image_encoders_glz_detach_from_drawable(drawable); + image_encoders_glz_detach_from_drawable_ring(&drawable->glz_ring); if (drawable->red_drawable) { red_drawable_unref(drawable->red_drawable); -- 2.7.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel