From bac427661968d5960c5942858d03103d0ebd2c35 Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Sun, 3 Dec 2006 19:05:51 +1100 Subject: Fix cursor image handling bugs First, don't destroy the previous cursor when relacing it as it's common for applications to store a bunch of cursor images and flipping them in, they don't want to have to re-create them each time. Then, there was a NULL-deref when setting the cursor to NULL to remove it Signed-off-by: Benjamin Herrenschmidt --- twin_screen.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/twin_screen.c b/twin_screen.c index bfa8f83..0781c91 100644 --- a/twin_screen.c +++ b/twin_screen.c @@ -293,17 +293,16 @@ void twin_screen_set_cursor (twin_screen_t *screen, twin_pixmap_t *pixmap, twin_fixed_t hotspot_x, twin_fixed_t hotspot_y) { - if (screen->cursor) { + if (screen->cursor) twin_screen_damage_cursor(screen); - twin_pixmap_destroy(screen->cursor); - } screen->cursor = pixmap; screen->curs_hx = hotspot_x; screen->curs_hy = hotspot_y; - pixmap->x = screen->curs_x - hotspot_x; - pixmap->y = screen->curs_y - hotspot_y; - if (pixmap) - twin_screen_damage_cursor(screen); + if (pixmap) { + pixmap->x = screen->curs_x - hotspot_x; + pixmap->y = screen->curs_y - hotspot_y; + twin_screen_damage_cursor(screen); + } } static void -- cgit v1.2.3