summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorKeith Packard <keithp@koto.keithp.com>2007-08-19 20:28:05 -0700
committerKeith Packard <keithp@koto.keithp.com>2007-08-20 23:24:12 -0700
commit7dc8531548cc9573e28bb04363dcbb3af5864c9a (patch)
tree34bc80d60c79d16e3fc080b1c757c081b77a5da4 /hw
parent1f6ddae003ec65d6bc567831bf32bf75dfefdd6c (diff)
Ref count cursors used in hw/xfree86/modes code.
The multi-crtc cursor code in hw/xfree86/modes holds a reference to the current cursor. This reference must be correctly ref counted so the cursor is not freed out from underneath this code.
Diffstat (limited to 'hw')
-rw-r--r--hw/xfree86/modes/xf86Cursors.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index 396bf3091..92b90a9d4 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -447,7 +447,10 @@ xf86_use_hw_cursor (ScreenPtr screen, CursorPtr cursor)
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ if (xf86_config->cursor)
+ FreeCursor (xf86_config->cursor, None);
xf86_config->cursor = cursor;
+ ++cursor->refcnt;
if (cursor->bits->width > cursor_info->MaxWidth ||
cursor->bits->height> cursor_info->MaxHeight)
@@ -463,7 +466,10 @@ xf86_use_hw_cursor_argb (ScreenPtr screen, CursorPtr cursor)
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ if (xf86_config->cursor)
+ FreeCursor (xf86_config->cursor, None);
xf86_config->cursor = cursor;
+ ++cursor->refcnt;
/* Make sure ARGB support is available */
if ((cursor_info->Flags & HARDWARE_CURSOR_ARGB) == 0)
@@ -632,4 +638,9 @@ xf86_cursors_fini (ScreenPtr screen)
xfree (xf86_config->cursor_image);
xf86_config->cursor_image = NULL;
}
+ if (xf86_config->cursor)
+ {
+ FreeCursor (xf86_config->cursor, None);
+ xf86_config->cursor = NULL;
+ }
}