xserver: Branch 'mpx' - 2 commits

Peter Hutterer whot at kemper.freedesktop.org
Thu Mar 29 12:44:33 EEST 2007


 dix/cursor.c |    8 +++++---
 dix/events.c |    4 ++--
 2 files changed, 7 insertions(+), 5 deletions(-)

New commits:
diff-tree 20e4314b178e1a093bce85e93329d4bcfb4f4210 (from 0c607f4b1902f993597e09ea7a2c83bc1cca9b96)
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Thu Mar 29 19:12:32 2007 +0930

    dix:    Try to get closer to the correct refcnt for cursors.
    
            This commit introduces a memory leak, as the refcnt never seems to get
            down to 0 and thus cursors will not be freed. Solves the problems with
            GNOME segfaulting every 30 seconds though.

diff --git a/dix/cursor.c b/dix/cursor.c
index c58e2fa..27ae9f1 100644
--- a/dix/cursor.c
+++ b/dix/cursor.c
@@ -196,11 +196,10 @@ AllocCursorARGB(unsigned char *psrcbits,
     bits->height = cm->height;
     bits->xhot = cm->xhot;
     bits->yhot = cm->yhot;
-    bits->refcnt = -1;
+    pCurs->refcnt = 0;		
     CheckForEmptyMask(bits);
 
     pCurs->bits = bits;
-    pCurs->refcnt = 1;		
 #ifdef XFIXES
     pCurs->serialNumber = ++cursorSerial;
     pCurs->name = None;
@@ -224,6 +223,7 @@ AllocCursorARGB(unsigned char *psrcbits,
         {
             if (DevHasCursor(pDev))
             {
+                pCurs->refcnt++;
                 if (!( *pscr->RealizeCursor)(pDev, pscr, pCurs))
                 {
                     /* Realize failed for device pDev on screen pscr.
@@ -419,7 +419,7 @@ AllocGlyphCursor(Font source, unsigned s
     }
     CheckForEmptyMask(bits);
     pCurs->bits = bits;
-    pCurs->refcnt = 1;
+    pCurs->refcnt = 0;
 #ifdef XFIXES
     pCurs->serialNumber = ++cursorSerial;
     pCurs->name = None;
@@ -440,6 +440,7 @@ AllocGlyphCursor(Font source, unsigned s
     {
         pscr = screenInfo.screens[nscr];
 
+        pCurs->refcnt++;
         if (!(*pscr->RealizeCursor)(inputInfo.pointer, pscr, pCurs))
         {
             DeviceIntPtr pDevIt = inputInfo.devices; /*dev iterator*/
@@ -470,6 +471,7 @@ AllocGlyphCursor(Font source, unsigned s
         {
             if (DevHasCursor(pDev))
             {
+                pCurs->refcnt++;
                 if (!( *pscr->RealizeCursor)(pDev, pscr, pCurs))
                 {
                     /* Realize failed for device pDev on screen pscr.
diff-tree 0c607f4b1902f993597e09ea7a2c83bc1cca9b96 (from 5f9c10e8da0d9d96cc00a38cdf9a8c3030063e03)
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Thu Mar 29 14:43:50 2007 +0930

    dix:    Pick keyboard instead of using virtual keyboard in Grab/UngrabKey.

diff --git a/dix/events.c b/dix/events.c
index 9f7e08d..a51a56c 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4433,7 +4433,7 @@ ProcUngrabKey(ClientPtr client)
     REQUEST(xUngrabKeyReq);
     WindowPtr pWin;
     GrabRec tempGrab;
-    DeviceIntPtr keybd = inputInfo.keyboard;
+    DeviceIntPtr keybd = PickKeyboard(client);
     int rc;
 
     REQUEST_SIZE_MATCH(xUngrabKeyReq);
@@ -4475,7 +4475,7 @@ ProcGrabKey(ClientPtr client)
     WindowPtr pWin;
     REQUEST(xGrabKeyReq);
     GrabPtr grab;
-    DeviceIntPtr keybd = inputInfo.keyboard;
+    DeviceIntPtr keybd = PickKeyboard(client);
     int rc;
 
     REQUEST_SIZE_MATCH(xGrabKeyReq);



More information about the xorg-commit mailing list