mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-19 12:48:30 +02:00
st/xorg: Work around cursor reference counting bugs in older X servers.
Could result in use of freed memory and consequently random crashes, e.g. on screen resize.
This commit is contained in:
parent
a8f3b3f88a
commit
21c91b410a
3 changed files with 20 additions and 0 deletions
|
|
@ -276,7 +276,21 @@ err_bo_destroy:
|
|||
static void
|
||||
crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image)
|
||||
{
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
|
||||
modesettingPtr ms = modesettingPTR(crtc->scrn);
|
||||
|
||||
/* Older X servers have cursor reference counting bugs leading to use of
|
||||
* freed memory and consequently random crashes. Should be fixed as of
|
||||
* xserver 1.8, but this workaround shouldn't hurt anyway.
|
||||
*/
|
||||
if (config->cursor)
|
||||
config->cursor->refcnt++;
|
||||
|
||||
if (ms->cursor)
|
||||
FreeCursor(ms->cursor, None);
|
||||
|
||||
ms->cursor = config->cursor;
|
||||
|
||||
if (ms->screen)
|
||||
crtc_load_cursor_argb_ga3d(crtc, image);
|
||||
#ifdef HAVE_LIBKMS
|
||||
|
|
|
|||
|
|
@ -949,6 +949,11 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen)
|
|||
drv_leave_vt(scrnIndex, 0);
|
||||
}
|
||||
|
||||
if (ms->cursor) {
|
||||
FreeCursor(ms->cursor, None);
|
||||
ms->cursor = NULL;
|
||||
}
|
||||
|
||||
if (cust && cust->winsys_screen_close)
|
||||
cust->winsys_screen_close(cust);
|
||||
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ typedef struct _modesettingRec
|
|||
|
||||
Bool noAccel;
|
||||
Bool SWCursor;
|
||||
CursorPtr cursor;
|
||||
Bool swapThrottling;
|
||||
Bool dirtyThrottling;
|
||||
CloseScreenProcPtr CloseScreen;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue