[PATCH] [xorg/xserver] mi/misprite: release private record

Erkki Seppala erkki.seppala at vincit.fi
Wed Mar 9 06:19:06 PST 2011


On 09.03.2011 15:57, Daniel Stone wrote:
> You could get this automatically by having miSpriteDevPrivatesKey
> allocate sizeof(miCursorInfoRec), rather than doing the allocation and
> free separately.

Thanks for the feedback!

I considered this with Rami, but it appeared that it uses the NULLness 
of the pointer for making a decision. In file misprite.c:

#define MISPRITE(dev) \
     ((!IsMaster(dev) && !dev->u.master) ? \
        (miCursorInfoPtr)dixLookupPrivate(&dev->devPrivates, 
miSpriteDevPrivatesKey) : \
        (miCursorInfoPtr)dixLookupPrivate(&(GetMaster(dev, 
MASTER_POINTER))->devPrivates, miSpriteDevPrivatesKey))

..

static void
miSpriteBlockHandler (int i, pointer blockData, pointer pTimeout,
                       pointer pReadmask)
{ ..
     for(pDev = inputInfo.devices; pDev; pDev = pDev->next)
     {
         if (DevHasCursor(pDev))
         {
             pCursorInfo = MISPRITE(pDev);
             if (pCursorInfo && !pCursorInfo->isUp
                     && pCursorInfo->pScreen == pScreen
                     && pCursorInfo->shouldBeUp)
             {
                 SPRITE_DEBUG (("BlockHandler save"));
                 miSpriteSaveUnderCursor (pDev, pScreen);
             }
         }
     }

So at least this code is prepared to handle the case that the privates 
are not allocated. Is this something that can never actually happen, and 
therefore one could just use the automated mechanism?

(I guess I should've mentioned this in the commit message already ;-).)


More information about the xorg-devel mailing list