Patchwork [1/2] gtk: fix cursor unref

login
register
mail settings
Submitter Gerd Hoffmann
Date April 26, 2013, 11:24 a.m.
Message ID <1366975466-21509-2-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/239805/
State New
Headers show

Comments

Gerd Hoffmann - April 26, 2013, 11:24 a.m.
Use correct unref function, cursors are not gobjects (at least in gtk2).
Fixes crash, reproducer: "qemu -vga qxl -display gtk".

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Anthony Liguori - April 26, 2013, 12:47 p.m.
Gerd Hoffmann <kraxel@redhat.com> writes:

> Use correct unref function, cursors are not gobjects (at least in gtk2).
> Fixes crash, reproducer: "qemu -vga qxl -display gtk".
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>

Regards,

Anthony Liguori

> ---
>  ui/gtk.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ui/gtk.c b/ui/gtk.c
> index 42e3c0a..71fda24 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -359,7 +359,7 @@ static void gd_cursor_define(DisplayChangeListener *dcl,
>                                          pixbuf, c->hot_x, c->hot_y);
>      gdk_window_set_cursor(gtk_widget_get_window(s->drawing_area), cursor);
>      g_object_unref(pixbuf);
> -    g_object_unref(cursor);
> +    gdk_cursor_unref(cursor);
>  }
>  
>  static void gd_switch(DisplayChangeListener *dcl,
> -- 
> 1.7.9.7

Patch

diff --git a/ui/gtk.c b/ui/gtk.c
index 42e3c0a..71fda24 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -359,7 +359,7 @@  static void gd_cursor_define(DisplayChangeListener *dcl,
                                         pixbuf, c->hot_x, c->hot_y);
     gdk_window_set_cursor(gtk_widget_get_window(s->drawing_area), cursor);
     g_object_unref(pixbuf);
-    g_object_unref(cursor);
+    gdk_cursor_unref(cursor);
 }
 
 static void gd_switch(DisplayChangeListener *dcl,