You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by mj...@apache.org on 2016/03/20 03:24:50 UTC

[20/50] incubator-guacamole-server git commit: GUAC-1164: Dispose of layers/buffers when display/cursor are freed.

GUAC-1164: Dispose of layers/buffers when display/cursor are freed.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/2e73e5ee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/2e73e5ee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/2e73e5ee

Branch: refs/heads/master
Commit: 2e73e5eef98965b7b568955e64c510e5d4544447
Parents: fc40e9f
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Tue Mar 15 21:49:26 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Tue Mar 15 21:49:26 2016 -0700

----------------------------------------------------------------------
 src/common/guac_cursor.c  | 14 +++++++++++---
 src/common/guac_display.c |  3 +++
 2 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/2e73e5ee/src/common/guac_cursor.c
----------------------------------------------------------------------
diff --git a/src/common/guac_cursor.c b/src/common/guac_cursor.c
index 55a01bf..7c309b9 100644
--- a/src/common/guac_cursor.c
+++ b/src/common/guac_cursor.c
@@ -29,6 +29,7 @@
 
 #include <cairo/cairo.h>
 #include <guacamole/client.h>
+#include <guacamole/layer.h>
 #include <guacamole/protocol.h>
 #include <guacamole/socket.h>
 #include <guacamole/user.h>
@@ -70,13 +71,20 @@ guac_common_cursor* guac_common_cursor_alloc(guac_client* client) {
 
 void guac_common_cursor_free(guac_common_cursor* cursor) {
 
+    guac_client* client = cursor->client;
+    guac_layer* layer = cursor->layer;
+    cairo_surface_t* surface = cursor->surface;
+
     /* Free image buffer and surface */
     free(cursor->image_buffer);
-    if (cursor->surface != NULL)
-        cairo_surface_destroy(cursor->surface);
+    if (surface != NULL)
+        cairo_surface_destroy(surface);
+
+    /* Destroy layer within remotely-connected client */
+    guac_protocol_send_dispose(client->socket, layer);
 
     /* Return layer to pool */
-    guac_client_free_layer(cursor->client, cursor->layer);
+    guac_client_free_layer(client, layer);
 
     free(cursor);
 

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/2e73e5ee/src/common/guac_display.c
----------------------------------------------------------------------
diff --git a/src/common/guac_display.c b/src/common/guac_display.c
index 5a918e7..4ea9652 100644
--- a/src/common/guac_display.c
+++ b/src/common/guac_display.c
@@ -84,6 +84,9 @@ static void guac_common_display_free_layers(guac_common_display_layer* layers,
         /* Free surface */
         guac_common_surface_free(current->surface);
 
+        /* Destroy layer within remotely-connected client */
+        guac_protocol_send_dispose(client->socket, layer);
+
         /* Free layer or buffer depending on index */
         if (layer->index < 0)
             guac_client_free_buffer(client, layer);