summaryrefslogtreecommitdiff
path: root/dix/cursor.c
diff options
context:
space:
mode:
Diffstat (limited to 'dix/cursor.c')
-rw-r--r--dix/cursor.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/dix/cursor.c b/dix/cursor.c
index 1ee127ac5..0820b18ad 100644
--- a/dix/cursor.c
+++ b/dix/cursor.c
@@ -114,9 +114,13 @@ FreeCursor(pointer value, XID cid)
ScreenPtr pscr;
DeviceIntPtr pDev = NULL; /* unused anyway */
- if (--pCurs->refcnt != 0)
+
+ UnrefCursor(pCurs);
+ if (CursorRefCount(pCurs) != 0)
return Success;
+ BUG_WARN(CursorRefCount(pCurs) < 0);
+
for (nscr = 0; nscr < screenInfo.numScreens; nscr++) {
pscr = screenInfo.screens[nscr];
(void) (*pscr->UnrealizeCursor) (pDev, pscr, pCurs);
@@ -127,6 +131,33 @@ FreeCursor(pointer value, XID cid)
return Success;
}
+CursorPtr
+RefCursor(CursorPtr cursor)
+{
+ ErrorF("%s ::::: cursor is %p", __func__, cursor);
+ if (cursor) {
+ xorg_backtrace();
+ cursor->refcnt++;
+ }
+ ErrorF("\n");
+ return cursor;
+}
+
+CursorPtr
+UnrefCursor(CursorPtr cursor)
+{
+ if (cursor)
+ cursor->refcnt--;
+ return cursor;
+}
+
+int
+CursorRefCount(const CursorPtr cursor)
+{
+ return cursor ? cursor->refcnt : 0;
+}
+
+
/*
* We check for empty cursors so that we won't have to display them
*/