xserver/miext/damage damage.c,1.11,1.12
Keith Packard
xserver-commit at pdx.freedesktop.org
Fri Jun 4 09:10:52 PDT 2004
Committed by: keithp
Update of /cvs/xserver/xserver/miext/damage
In directory pdx:/tmp/cvs-serv724/miext/damage
Modified Files:
damage.c
Log Message:
2004-06-04 Keith Packard <keithp at keithp.com>
* configure.ac:
* hw/Makefile.am:
Add top-level build support for GL X server (not working yet)
* composite/compinit.c: (compAddAlternateVisuals):
Fix a few allocation bugs with alternate visual ids
Allow for non-8/8/8 alternate visuals
* hw/kdrive/src/kshadow.c: (KdShadowSet):
Turn off any existing shadow before enabling it again
(avoids re-registering existing damage)
* miext/damage/damage.c: (damageRemoveDamage),
(damageInsertDamage), (DamageRegister), (DamageUnregister):
Add some validation code to catch re-registered damages
Index: damage.c
===================================================================
RCS file: /cvs/xserver/xserver/miext/damage/damage.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- a/damage.c 26 Feb 2004 19:26:32 -0000 1.11
+++ b/damage.c 4 Jun 2004 16:10:50 -0000 1.12
@@ -53,6 +53,7 @@
(a)->x2 == (b)->x2 && \
(a)->y2 == (b)->y2)
+#define DAMAGE_VALIDATE_ENABLE 0
#define DAMAGE_DEBUG_ENABLE 0
#if DAMAGE_DEBUG_ENABLE
#define DAMAGE_DEBUG(x) ErrorF x
@@ -1449,10 +1450,14 @@
if (*pPrev == pDamage)
{
*pPrev = pDamage->pNext;
- break;
+ return;
}
pPrev = &(*pPrev)->pNext;
}
+#if DAMAGE_VALIDATE_ENABLE
+ ErrorF ("Damage not on list\n");
+ abort ();
+#endif
}
static void
@@ -1460,6 +1465,15 @@
{
pixDamageRef (pPixmap);
+#if DAMAGE_VALIDATE_ENABLE
+ DamagePtr pOld;
+
+ for (pOld = *pPrev; pOld; pOld = pOld->pNext)
+ if (pOld == pDamage) {
+ ErrorF ("Damage already on list\n");
+ abort ();
+ }
+#endif
pDamage->pNext = *pPrev;
*pPrev = pDamage;
}
@@ -1741,6 +1755,15 @@
WindowPtr pWindow = (WindowPtr) pDrawable;
winDamageRef(pWindow);
+#if DAMAGE_VALIDATE_ENABLE
+ DamagePtr pOld;
+
+ for (pOld = *pPrev; pOld; pOld = pOld->pNextWin)
+ if (pOld == pDamage) {
+ ErrorF ("Damage already on window list\n");
+ abort ();
+ }
+#endif
pDamage->pNextWin = *pPrev;
*pPrev = pDamage;
pDamage->isWindow = TRUE;
@@ -1767,16 +1790,28 @@
{
WindowPtr pWindow = (WindowPtr) pDrawable;
winDamageRef (pWindow);
+#if DAMAGE_VALIDATE_ENABLE
+ int found = 0;
+#endif
while (*pPrev)
{
if (*pPrev == pDamage)
{
*pPrev = pDamage->pNextWin;
+#if DAMAGE_VALIDATE_ENABLE
+ found = 1;
+#endif
break;
}
pPrev = &(*pPrev)->pNextWin;
}
+#if DAMAGE_VALIDATE_ENABLE
+ if (!found) {
+ ErrorF ("Damage not on window list\n");
+ abort ();
+ }
+#endif
}
pDamage->pDrawable = 0;
damageRemoveDamage (GetDrawablePixmap (pDrawable), pDamage);
More information about the xserver-commit
mailing list