[Spice-devel] [spice-server 05/10] Simplify red_drawable_unref()

Christophe Fergeau cfergeau at redhat.com
Fri Feb 12 17:51:04 UTC 2016


Now it no longer needs external state in order to destroy the
RedDrawable instance when needed, so we can remove this from the
prototype.
---
 server/dcc-encoders.c    | 3 +--
 server/display-channel.c | 2 +-
 server/red-worker.c      | 5 ++---
 server/red-worker.h      | 4 +---
 4 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c
index c810b8e..f1dd1bb 100644
--- a/server/dcc-encoders.c
+++ b/server/dcc-encoders.c
@@ -483,8 +483,7 @@ void dcc_free_glz_drawable_instance(DisplayChannelClient *dcc,
         if (drawable) {
             ring_remove(&glz_drawable->drawable_link);
         }
-        red_drawable_unref(display_channel, glz_drawable->red_drawable,
-                           glz_drawable->group_id);
+        red_drawable_unref(glz_drawable->red_drawable);
         display_channel->glz_drawable_count--;
         if (ring_item_is_linked(&glz_drawable->link)) {
             ring_remove(&glz_drawable->link);
diff --git a/server/display-channel.c b/server/display-channel.c
index fc74853..2d6abd4 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1444,7 +1444,7 @@ void display_channel_drawable_unref(DisplayChannel *display, Drawable *drawable)
         ring_remove(item);
     }
     if (drawable->red_drawable) {
-        red_drawable_unref(display, drawable->red_drawable, drawable->group_id);
+        red_drawable_unref(drawable->red_drawable);
     }
     drawable_free(display, drawable);
     display->drawable_count--;
diff --git a/server/red-worker.c b/server/red-worker.c
index 5937b00..3acab24 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -129,8 +129,7 @@ static void common_release_recv_buf(RedChannelClient *rcc, uint16_t type, uint32
     }
 }
 
-void red_drawable_unref(DisplayChannel *display, RedDrawable *red_drawable,
-                        uint32_t group_id)
+void red_drawable_unref(RedDrawable *red_drawable)
 {
     if (--red_drawable->refs) {
         return;
@@ -239,7 +238,7 @@ static int red_process_display(RedWorker *worker, int *ring_is_empty)
                                              worker->process_display_generation);
             }
             // release the red_drawable
-            red_drawable_unref(worker->display_channel, red_drawable, ext_cmd.group_id);
+            red_drawable_unref(red_drawable);
             break;
         }
         case QXL_CMD_UPDATE: {
diff --git a/server/red-worker.h b/server/red-worker.h
index 1285942..94974b7 100644
--- a/server/red-worker.h
+++ b/server/red-worker.h
@@ -97,9 +97,7 @@ QXLInstance* red_worker_get_qxl(RedWorker *worker);
 RedChannel* red_worker_get_cursor_channel(RedWorker *worker);
 RedChannel* red_worker_get_display_channel(RedWorker *worker);
 
-struct DisplayChannel;
-void red_drawable_unref(struct DisplayChannel *display, RedDrawable *red_drawable,
-                        uint32_t group_id);
+void red_drawable_unref(RedDrawable *red_drawable);
 
 CommonChannel *red_worker_new_channel(RedWorker *worker, int size,
                                    const char *name,
-- 
2.5.0



More information about the Spice-devel mailing list