Bug #4699: Correct some memory leaks in EXA and damage related to region

handling.
This commit is contained in:
Eric Anholt 2005-10-06 21:55:41 +00:00
parent cd9ff6aec8
commit 1614a31a9d
4 changed files with 13 additions and 8 deletions

View File

@ -511,6 +511,7 @@ exaComposite(CARD8 op,
REGION_RECTS(&region), REGION_NUM_RECTS(&region), REGION_RECTS(&region), REGION_NUM_RECTS(&region),
xSrc - xDst, ySrc - yDst, xSrc - xDst, ySrc - yDst,
FALSE, FALSE, 0, NULL); FALSE, FALSE, 0, NULL);
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return; return;
} }
} }

View File

@ -511,6 +511,7 @@ exaComposite(CARD8 op,
REGION_RECTS(&region), REGION_NUM_RECTS(&region), REGION_RECTS(&region), REGION_NUM_RECTS(&region),
xSrc - xDst, ySrc - yDst, xSrc - xDst, ySrc - yDst,
FALSE, FALSE, 0, NULL); FALSE, FALSE, 0, NULL);
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return; return;
} }
} }

View File

@ -511,6 +511,7 @@ exaComposite(CARD8 op,
REGION_RECTS(&region), REGION_NUM_RECTS(&region), REGION_RECTS(&region), REGION_NUM_RECTS(&region),
xSrc - xDst, ySrc - yDst, xSrc - xDst, ySrc - yDst,
FALSE, FALSE, 0, NULL); FALSE, FALSE, 0, NULL);
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return; return;
} }
} }

View File

@ -125,7 +125,6 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip,
damageScrPriv(pScreen); damageScrPriv(pScreen);
drawableDamage(pDrawable); drawableDamage(pDrawable);
DamagePtr pNext; DamagePtr pNext;
RegionPtr pClip;
RegionRec clippedRec; RegionRec clippedRec;
RegionPtr pDamageRegion; RegionPtr pDamageRegion;
RegionRec pixClip; RegionRec pixClip;
@ -169,7 +168,7 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip,
RegionPtr pTempRegion = RegionPtr pTempRegion =
NotClippedByChildren((WindowPtr)(pDrawable)); NotClippedByChildren((WindowPtr)(pDrawable));
REGION_INTERSECT(pScreen, pRegion, pRegion, pTempRegion); REGION_INTERSECT(pScreen, pRegion, pRegion, pTempRegion);
REGION_UNINIT(pScreen, pTempRegion); REGION_DESTROY(pScreen, pTempRegion);
} }
/* If subWindowMode is set to an invalid value, don't perform /* If subWindowMode is set to an invalid value, don't perform
* any drawable-based clipping. */ * any drawable-based clipping. */
@ -223,19 +222,19 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip,
if (clip || pDamage->pDrawable != pDrawable) if (clip || pDamage->pDrawable != pDrawable)
{ {
pDamageRegion = &clippedRec; pDamageRegion = &clippedRec;
if (pDamage->pDrawable->type == DRAWABLE_WINDOW) if (pDamage->pDrawable->type == DRAWABLE_WINDOW) {
pClip = &((WindowPtr)(pDamage->pDrawable))->borderClip; REGION_INTERSECT (pScreen, pDamageRegion, pRegion,
else &((WindowPtr)(pDamage->pDrawable))->borderClip);
{ } else {
BoxRec box; BoxRec box;
box.x1 = draw_x; box.x1 = draw_x;
box.y1 = draw_y; box.y1 = draw_y;
box.x2 = draw_x + pDamage->pDrawable->width; box.x2 = draw_x + pDamage->pDrawable->width;
box.y2 = draw_y + pDamage->pDrawable->height; box.y2 = draw_y + pDamage->pDrawable->height;
REGION_INIT(pScreen, &pixClip, &box, 1); REGION_INIT(pScreen, &pixClip, &box, 1);
pClip = &pixClip; REGION_INTERSECT (pScreen, pDamageRegion, pRegion, &pixClip);
REGION_UNINIT(pScreen, &pixClip);
} }
REGION_INTERSECT (pScreen, pDamageRegion, pRegion, pClip);
/* /*
* Short circuit empty results * Short circuit empty results
*/ */
@ -269,6 +268,7 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip,
&pDamage->damage, pDamageRegion); &pDamage->damage, pDamageRegion);
(*pDamage->damageReport) (pDamage, &tmpRegion, pDamage->closure); (*pDamage->damageReport) (pDamage, &tmpRegion, pDamage->closure);
} }
REGION_UNINIT(pScreen, &tmpRegion);
break; break;
case DamageReportBoundingBox: case DamageReportBoundingBox:
tmpBox = *REGION_EXTENTS (pScreen, &pDamage->damage); tmpBox = *REGION_EXTENTS (pScreen, &pDamage->damage);
@ -1940,6 +1940,8 @@ DamageSubtract (DamagePtr pDamage,
REGION_TRANSLATE (pDrawable->pScreen, &pDamage->damage, pDrawable->x, pDrawable->y); REGION_TRANSLATE (pDrawable->pScreen, &pDamage->damage, pDrawable->x, pDrawable->y);
REGION_INTERSECT (pDrawable->pScreen, &pDamage->damage, &pDamage->damage, pClip); REGION_INTERSECT (pDrawable->pScreen, &pDamage->damage, &pDamage->damage, pClip);
REGION_TRANSLATE (pDrawable->pScreen, &pDamage->damage, -pDrawable->x, -pDrawable->y); REGION_TRANSLATE (pDrawable->pScreen, &pDamage->damage, -pDrawable->x, -pDrawable->y);
if (pDrawable->type != DRAWABLE_WINDOW)
REGION_UNINIT(pDrawable->pScreen, &pixmapClip);
} }
return REGION_NOTEMPTY (pDrawable->pScreen, &pDamage->damage); return REGION_NOTEMPTY (pDrawable->pScreen, &pDamage->damage);
} }