diff options
author | Keith Packard <keithp@koto.keithp.com> | 2007-08-19 20:28:05 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2007-08-23 12:22:35 -0700 |
commit | efac9c9c2e7cfa974fb0e7737832f0e34d156f65 (patch) | |
tree | ecb386489e1b068b214cba9c5a0e828b0e40b844 /hw | |
parent | 248b220b3e2bf8d999241543b69be3022a728b3a (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.
(cherry picked from commit 7dc8531548cc9573e28bb04363dcbb3af5864c9a)
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xfree86/modes/xf86Cursors.c | 11 |
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; + } } |