summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-04-30 16:10:32 -0700
committerPeter Hutterer <peter.hutterer@who-t.net>2010-05-18 14:42:16 +1000
commitdee99e6925c8e51263398bd2c8fb70289dae748c (patch)
treec08f2eb737625ac59c1ac172bda29192d259c94a
parentede10681c4f9d835fa8af115e349e2fd9feeb697 (diff)
Make sure XFixes invisible cursor gets freed on server reset
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. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com> (cherry picked from commit a3f5d30ba61e70b3de8b48754dea32715ba93c40) Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--xfixes/cursor.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 1471a58d1..2aba0cec9 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;
}