[Xquartz-changes] xserver: Branch 'master' - 3 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Tue May 4 13:09:43 PDT 2010


 dix/devices.c                  |    2 ++
 dix/events.c                   |   20 +++++++++++++++-----
 hw/xfree86/ramdac/xf86Cursor.c |    2 ++
 hw/xquartz/bundle/Makefile.am  |    4 ++++
 xfixes/cursor.c                |   23 ++++++++++++-----------
 5 files changed, 35 insertions(+), 16 deletions(-)

New commits:
commit 72758287f79a4f1aa8fa388f20947042e3e14693
Author: Julien Cristau <jcristau at debian.org>
Date:   Tue May 4 15:15:02 2010 +0200

    XQuartz: add new localization files to EXTRA_DIST
    
    commit 206531f75cd41c034e89fdfbc75ab0910682eef8 added localization files
    for ar, add them to the Makefile.
    
    Signed-off-by: Julien Cristau <jcristau at debian.org>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/bundle/Makefile.am b/hw/xquartz/bundle/Makefile.am
index f8b96d8..c4d77c0 100644
--- a/hw/xquartz/bundle/Makefile.am
+++ b/hw/xquartz/bundle/Makefile.am
@@ -28,6 +28,10 @@ EXTRA_DIST = \
 	Info.plist.cpp \
 	PkgInfo \
 	$(resource_DATA) \
+	Resources/ar.lproj/InfoPlist.strings \
+	Resources/ar.lproj/Localizable.strings \
+	Resources/ar.lproj/main.nib/designable.nib \
+	Resources/ar.lproj/main.nib/keyedobjects.nib \
 	Resources/da.lproj/InfoPlist.strings \
 	Resources/da.lproj/Localizable.strings \
 	Resources/da.lproj/main.nib/keyedobjects.nib \
commit a3f5d30ba61e70b3de8b48754dea32715ba93c40
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Apr 30 16:10:32 2010 -0700

    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 at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

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;
 }
commit cdeb2c23f80ced961fe205125547e16905885534
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Apr 30 12:18:09 2010 -0700

    Fix cursor ref counting mistakes with sprites and xf86Cursor.c
    
    A few cursor value assignments weren't getting correctly ref counted,
    causing leaks of cursor objects.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/devices.c b/dix/devices.c
index 1386491..a33df4d 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -851,6 +851,8 @@ CloseDevice(DeviceIntPtr dev)
     }
 
     if (DevHasCursor(dev) && dev->spriteInfo->sprite) {
+	if (dev->spriteInfo->sprite->current)
+	    FreeCursor(dev->spriteInfo->sprite->current, None);
         xfree(dev->spriteInfo->sprite->spriteTrace);
         xfree(dev->spriteInfo->sprite);
     }
diff --git a/dix/events.c b/dix/events.c
index 9dd7356..f96fe1c 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2932,6 +2932,7 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
 {
     SpritePtr pSprite;
     ScreenPtr pScreen;
+    CursorPtr pCursor;
 
     if (!pDev->spriteInfo->sprite)
     {
@@ -2975,8 +2976,7 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
 
     if (pWin)
     {
-        pSprite->current = wCursor(pWin);
-        pSprite->current->refcnt++;
+	pCursor = wCursor(pWin);
 	pSprite->spriteTrace = (WindowPtr *)xcalloc(1, 32*sizeof(WindowPtr));
 	if (!pSprite->spriteTrace)
 	    FatalError("Failed to allocate spriteTrace");
@@ -2989,13 +2989,18 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
 	pSprite->pDequeueScreen = pSprite->pEnqueueScreen;
 
     } else {
-        pSprite->current = NullCursor;
+        pCursor = NullCursor;
 	pSprite->spriteTrace = NULL;
 	pSprite->spriteTraceSize = 0;
 	pSprite->spriteTraceGood = 0;
 	pSprite->pEnqueueScreen = screenInfo.screens[0];
 	pSprite->pDequeueScreen = pSprite->pEnqueueScreen;
     }
+    if (pCursor)
+	pCursor->refcnt++;
+    if (pSprite->current)
+	FreeCursor(pSprite->current, None);
+    pSprite->current = pCursor;
 
     if (pScreen)
     {
@@ -3048,6 +3053,7 @@ UpdateSpriteForScreen(DeviceIntPtr pDev, ScreenPtr pScreen)
 {
     SpritePtr pSprite = NULL;
     WindowPtr win = NULL;
+    CursorPtr pCursor;
     if (!pScreen)
         return ;
 
@@ -3063,8 +3069,12 @@ UpdateSpriteForScreen(DeviceIntPtr pDev, ScreenPtr pScreen)
     pSprite->hotLimits.x2 = pScreen->width;
     pSprite->hotLimits.y2 = pScreen->height;
     pSprite->win = win;
-    pSprite->current = wCursor (win);
-    pSprite->current->refcnt++;
+    pCursor = wCursor(win);
+    if (pCursor)
+	pCursor->refcnt++;
+    if (pSprite->current)
+	FreeCursor(pSprite->current, 0);
+    pSprite->current = pCursor;
     pSprite->spriteTraceGood = 1;
     pSprite->spriteTrace[0] = win;
     (*pScreen->CursorLimits) (pDev,
diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c
index f5f0873..346e994 100644
--- a/hw/xfree86/ramdac/xf86Cursor.c
+++ b/hw/xfree86/ramdac/xf86Cursor.c
@@ -312,6 +312,8 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
             xf86SetCursor(pScreen, NullCursor, x, y);
             ScreenPriv->isUp = FALSE;
         }
+	if (ScreenPriv->CurrentCursor)
+	    FreeCursor(ScreenPriv->CurrentCursor, None);
         ScreenPriv->CurrentCursor = NullCursor;
         return;
     }


More information about the Xquartz-changes mailing list