mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-25 12:49:21 +00:00
miext: damage: tolerate NULL pointers in DamageScreenFuncsRec
For now that case doensn't practically happen yet - all fields are at least assigned to some default/dummy function. But in the future, we might wanna get rid of dummies. From now on, video drivers are allowed to assign them to NULL, if they don't wanna have the default implementations and nothing happening at all instead (no more need for having their own empty dummies) Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
02bba6d9b3
commit
9c3d48fa24
@@ -1714,7 +1714,8 @@ DamageCreate(DamageReportFunc damageReport,
|
||||
pDamage->damageDestroy = damageDestroy;
|
||||
pDamage->pScreen = pScreen;
|
||||
|
||||
(*pScrPriv->funcs.Create) (pDamage);
|
||||
if (pScrPriv->funcs.Create)
|
||||
pScrPriv->funcs.Create (pDamage);
|
||||
|
||||
return pDamage;
|
||||
}
|
||||
@@ -1755,7 +1756,8 @@ DamageRegister(DrawablePtr pDrawable, DamagePtr pDamage)
|
||||
pDamage->isWindow = FALSE;
|
||||
pDamage->pDrawable = pDrawable;
|
||||
damageInsertDamage(getDrawableDamageRef(pDrawable), pDamage);
|
||||
(*pScrPriv->funcs.Register) (pDrawable, pDamage);
|
||||
if (pScrPriv->funcs.Register)
|
||||
pScrPriv->funcs.Register (pDrawable, pDamage);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1774,7 +1776,8 @@ DamageUnregister(DamagePtr pDamage)
|
||||
|
||||
damageScrPriv(pScreen);
|
||||
|
||||
(*pScrPriv->funcs.Unregister) (pDrawable, pDamage);
|
||||
if (pScrPriv->funcs.Unregister)
|
||||
pScrPriv->funcs.Unregister (pDrawable, pDamage);
|
||||
|
||||
if (pDrawable->type == DRAWABLE_WINDOW) {
|
||||
WindowPtr pWindow = (WindowPtr) pDrawable;
|
||||
@@ -1817,7 +1820,10 @@ DamageDestroy(DamagePtr pDamage)
|
||||
|
||||
if (pDamage->damageDestroy)
|
||||
(*pDamage->damageDestroy) (pDamage, pDamage->closure);
|
||||
(*pScrPriv->funcs.Destroy) (pDamage);
|
||||
|
||||
if (pScrPriv->funcs.Destroy)
|
||||
pScrPriv->funcs.Destroy (pDamage);
|
||||
|
||||
RegionUninit(&pDamage->damage);
|
||||
RegionUninit(&pDamage->pendingDamage);
|
||||
free(pDamage);
|
||||
|
||||
@@ -54,6 +54,9 @@ typedef void (*DamageScreenDestroyFunc) (DamagePtr);
|
||||
* Drivers can inject themselves here, in order to get notified on
|
||||
* DamageCreate(), DamageRegister(), DamageUnregister(), DamageDestroy().
|
||||
*
|
||||
* The fields may be assigned to NULL, if no action at all is wanted.
|
||||
* (by default assigned to default implementations)
|
||||
*
|
||||
* This should ONLY be touched by video drivers, nobody else.
|
||||
*
|
||||
* So far the only one using it is the proprietary NVidia driver.
|
||||
|
||||
Reference in New Issue
Block a user