summaryrefslogtreecommitdiff
path: root/dix/cursor.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2007-03-29 19:12:32 +0930
committerPeter Hutterer <peter@cs.unisa.edu.au>2007-03-29 19:12:32 +0930
commit20e4314b178e1a093bce85e93329d4bcfb4f4210 (patch)
treedbb0c4aa916f3435a49d62328d6b3e824babf010 /dix/cursor.c
parent0c607f4b1902f993597e09ea7a2c83bc1cca9b96 (diff)
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.
Diffstat (limited to 'dix/cursor.c')
-rw-r--r--dix/cursor.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/dix/cursor.c b/dix/cursor.c
index c58e2fa16..27ae9f17d 100644
--- a/dix/cursor.c
+++ b/dix/cursor.c
@@ -196,11 +196,10 @@ AllocCursorARGB(unsigned char *psrcbits, unsigned char *pmaskbits, CARD32 *argb,
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, unsigned char *pmaskbits, CARD32 *argb,
{
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 sourceChar, Font mask, unsigned maskChar,
}
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 sourceChar, Font mask, unsigned maskChar,
{
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 sourceChar, Font mask, unsigned maskChar,
{
if (DevHasCursor(pDev))
{
+ pCurs->refcnt++;
if (!( *pscr->RealizeCursor)(pDev, pscr, pCurs))
{
/* Realize failed for device pDev on screen pscr.