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:
Peter Hutterer
2013-05-15 19:01:11 +10:00
parent 35c2e263db
commit 9a5ad65330
10 changed files with 73 additions and 56 deletions

View File

@@ -613,12 +613,12 @@ ReplaceCursorLookup(pointer value, XID id, pointer closure)
}
if (pCursor && pCursor != rcl->pNew) {
if ((*rcl->testCursor) (pCursor, rcl->closure)) {
rcl->pNew->refcnt++;
CursorPtr curs = RefCursor(rcl->pNew);
/* either redirect reference or update resource database */
if (pCursorRef)
*pCursorRef = rcl->pNew;
*pCursorRef = curs;
else
ChangeResourceValue(id, RT_CURSOR, rcl->pNew);
ChangeResourceValue(id, RT_CURSOR, curs);
FreeCursor(pCursor, cursor);
}
}