[PATCH 2/2] Make sure XFixes invisible cursor gets freed on server reset
Keith Packard
keithp at keithp.com
Fri Apr 30 16:13:25 PDT 2010
This uses the same hack that dix uses for the rootCursor -- allocate
a resource ID for the invisible cursor so that it gets freed at reset
time. This also allows us to unconditionally create it during
extension initialization; necessary as the privates layout may well be
different on subsequent generations.
Signed-off-by: Keith Packard <keithp at keithp.com>
---
xfixes/cursor.c | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 1471a58..2aba0ce 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -1054,11 +1054,15 @@ createInvisibleCursor (void)
cm.xhot = 0;
cm.yhot = 0;
- AllocARGBCursor(psrcbits, pmaskbits,
- NULL, &cm,
- 0, 0, 0,
- 0, 0, 0,
- &pCursor, serverClient, (XID)0);
+ if (AllocARGBCursor(psrcbits, pmaskbits,
+ NULL, &cm,
+ 0, 0, 0,
+ 0, 0, 0,
+ &pCursor, serverClient, (XID)0) != Success)
+ return NullCursor;
+
+ if (!AddResource(FakeClientID(0), RT_CURSOR, (pointer) pCursor))
+ return NullCursor;
return pCursor;
}
@@ -1091,12 +1095,9 @@ XFixesCursorInit (void)
CursorWindowType = CreateNewResourceType(CursorFreeWindow,
"XFixesCursorWindow");
- if (pInvisibleCursor == NULL) {
- pInvisibleCursor = createInvisibleCursor();
- if (pInvisibleCursor == NULL) {
- return BadAlloc;
- }
- }
+ pInvisibleCursor = createInvisibleCursor();
+ if (pInvisibleCursor == NULL)
+ return BadAlloc;
return CursorClientType && CursorHideCountType && CursorWindowType;
}
--
1.7.0.4
More information about the xorg-devel
mailing list