[Spice-devel] [PATCH spice-gtk 3/3] Don't leak cursor shape objects

Marc-André Lureau marcandre.lureau at gmail.com
Fri Dec 9 06:59:34 PST 2011


---
 gtk/spice-widget.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index d9ee2f6..cfa5801 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -280,6 +280,21 @@ static void spice_display_finalize(GObject *obj)
     g_free(d->activeseq);
     d->activeseq = NULL;
 
+    if (d->show_cursor) {
+        gdk_cursor_unref(d->show_cursor);
+        d->show_cursor = NULL;
+    }
+
+    if (d->mouse_cursor) {
+        gdk_cursor_unref(d->mouse_cursor);
+        d->mouse_cursor = NULL;
+    }
+
+    if (d->mouse_pixbuf) {
+        g_object_unref(d->mouse_pixbuf);
+        d->mouse_pixbuf = NULL;
+    }
+
     G_OBJECT_CLASS(spice_display_parent_class)->finalize(obj);
 }
 
@@ -1486,6 +1501,11 @@ static void cursor_set(SpiceCursorChannel *channel,
 
     cursor_invalidate(display);
 
+    if (d->show_cursor) {
+        gdk_cursor_unref(d->show_cursor);
+        d->show_cursor = NULL;
+    }
+
     if (d->mouse_cursor) {
         gdk_cursor_unref(d->mouse_cursor);
         d->mouse_cursor = NULL;
-- 
1.7.7.3



More information about the Spice-devel mailing list