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.
This commit is contained in:
parent
1f6ddae003
commit
7dc8531548
|
@ -447,7 +447,10 @@ xf86_use_hw_cursor (ScreenPtr screen, CursorPtr cursor)
|
||||||
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
|
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||||
xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
|
xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
|
||||||
|
|
||||||
|
if (xf86_config->cursor)
|
||||||
|
FreeCursor (xf86_config->cursor, None);
|
||||||
xf86_config->cursor = cursor;
|
xf86_config->cursor = cursor;
|
||||||
|
++cursor->refcnt;
|
||||||
|
|
||||||
if (cursor->bits->width > cursor_info->MaxWidth ||
|
if (cursor->bits->width > cursor_info->MaxWidth ||
|
||||||
cursor->bits->height> cursor_info->MaxHeight)
|
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);
|
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||||
xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
|
xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
|
||||||
|
|
||||||
|
if (xf86_config->cursor)
|
||||||
|
FreeCursor (xf86_config->cursor, None);
|
||||||
xf86_config->cursor = cursor;
|
xf86_config->cursor = cursor;
|
||||||
|
++cursor->refcnt;
|
||||||
|
|
||||||
/* Make sure ARGB support is available */
|
/* Make sure ARGB support is available */
|
||||||
if ((cursor_info->Flags & HARDWARE_CURSOR_ARGB) == 0)
|
if ((cursor_info->Flags & HARDWARE_CURSOR_ARGB) == 0)
|
||||||
|
@ -632,4 +638,9 @@ xf86_cursors_fini (ScreenPtr screen)
|
||||||
xfree (xf86_config->cursor_image);
|
xfree (xf86_config->cursor_image);
|
||||||
xf86_config->cursor_image = NULL;
|
xf86_config->cursor_image = NULL;
|
||||||
}
|
}
|
||||||
|
if (xf86_config->cursor)
|
||||||
|
{
|
||||||
|
FreeCursor (xf86_config->cursor, None);
|
||||||
|
xf86_config->cursor = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue