[PATCH v2 16/19] cursor: Avoid cursor item leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/cursor-channel.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 202ec89..e421bf7 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -438,10 +438,25 @@ void cursor_channel_connect(CursorChannel *cursor, RedClient *client, RedsStream
 }
 
 static void
+cursor_channel_finalize(GObject *object)
+{
+    CursorChannel *self = CURSOR_CHANNEL(object);
+
+    if (self->item) {
+        cursor_item_unref(self->item);
+    }
+
+    G_OBJECT_CLASS(cursor_channel_parent_class)->finalize(object);
+}
+
+static void
 cursor_channel_class_init(CursorChannelClass *klass)
 {
+    GObjectClass *object_class = G_OBJECT_CLASS(klass);
     RedChannelClass *channel_class = RED_CHANNEL_CLASS(klass);
 
+    object_class->finalize = cursor_channel_finalize;
+
     channel_class->parser = spice_get_client_channel_parser(SPICE_CHANNEL_CURSOR, NULL);
     channel_class->handle_parsed = red_channel_client_handle_message;
 
-- 
git-series 0.9.1
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]