mirror of
https://github.com/X11Libre/xserver.git
synced 2026-11-03 03:24:39 +00:00
Abstract cursor refcounting
Too many callers relied on the refcnt being handled correctly. Use a simple wrapper to handle that case. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
35c2e263db
commit
9a5ad65330
10 changed files with 73 additions and 56 deletions
|
|
@ -531,15 +531,16 @@ CreateSaverWindow(ScreenPtr pScreen)
|
|||
mask |= CWBorderPixmap;
|
||||
}
|
||||
if (pAttr->pCursor) {
|
||||
CursorPtr cursor;
|
||||
if (!pWin->optional)
|
||||
if (!MakeWindowOptional(pWin)) {
|
||||
FreeResource(pWin->drawable.id, RT_NONE);
|
||||
return FALSE;
|
||||
}
|
||||
pAttr->pCursor->refcnt++;
|
||||
cursor = RefCursor(pAttr->pCursor);
|
||||
if (pWin->optional->cursor)
|
||||
FreeCursor(pWin->optional->cursor, (Cursor) 0);
|
||||
pWin->optional->cursor = pAttr->pCursor;
|
||||
pWin->optional->cursor = cursor;
|
||||
pWin->cursorIsNone = FALSE;
|
||||
CheckWindowOptionalNeed(pWin);
|
||||
mask |= CWCursor;
|
||||
|
|
@ -1065,8 +1066,7 @@ ScreenSaverSetAttributes(ClientPtr client)
|
|||
client->errorValue = cursorID;
|
||||
goto PatchUp;
|
||||
}
|
||||
pCursor->refcnt++;
|
||||
pAttr->pCursor = pCursor;
|
||||
pAttr->pCursor = RefCursor(pCursor);
|
||||
pAttr->mask &= ~CWCursor;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in a new issue