[PATCH 24/24] dix: fix cursor refcounting
Peter Hutterer
peter.hutterer at who-t.net
Thu May 9 22:30:59 PDT 2013
The cursor is referenced during CopyGrab(), thus doesn't need to be handled
manually anymore. It does need to be refcounted for temp grabs though.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
dix/events.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/dix/events.c b/dix/events.c
index 7464db5..fce7c4b 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1491,9 +1491,6 @@ ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
grabinfo->grabTime = syncEvents.time;
else
grabinfo->grabTime = time;
- if (grab->cursor)
- grab->cursor->refcnt++;
- BUG_WARN(grabinfo->grab != NULL);
grabinfo->grab = AllocGrab(grab);
grabinfo->fromPassiveGrab = isPassive;
grabinfo->implicitGrab = autoGrab & ImplicitGrabMask;
@@ -1552,8 +1549,6 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
if (grab->confineTo)
ConfineCursorToWindow(mouse, GetCurrentRootWindow(mouse), FALSE, FALSE);
PostNewCursor(mouse);
- if (grab->cursor)
- FreeCursor(grab->cursor, (Cursor) 0);
if (!wasImplicit && grab->grabtype == XI2)
ReattachToOldMaster(mouse);
@@ -5107,6 +5102,8 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
xi2mask_merge(tempGrab->xi2mask, mask->xi2mask);
tempGrab->device = dev;
tempGrab->cursor = cursor;
+ if (cursor)
+ tempGrab->cursor->refcnt++;
tempGrab->confineTo = confineTo;
tempGrab->grabtype = grabtype;
(*grabInfo->ActivateGrab) (dev, tempGrab, time, FALSE);
--
1.8.1.4
More information about the xorg-devel
mailing list