miext: damage: protect against NULL screen priv or funcs
Protect against SEGFAULT in cases where per-screen damage private hasn't been initialized yet or already destroyed, or function pointers not implemented. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
4036b8c163
commit
d93c87f71a
|
@ -1714,7 +1714,8 @@ DamageCreate(DamageReportFunc damageReport,
|
||||||
pDamage->damageDestroy = damageDestroy;
|
pDamage->damageDestroy = damageDestroy;
|
||||||
pDamage->pScreen = pScreen;
|
pDamage->pScreen = pScreen;
|
||||||
|
|
||||||
(*pScrPriv->funcs.Create) (pDamage);
|
if (pScrPriv && pScrPriv->funcs.Create)
|
||||||
|
pScrPriv->funcs.Create(pDamage);
|
||||||
|
|
||||||
return pDamage;
|
return pDamage;
|
||||||
}
|
}
|
||||||
|
@ -1755,7 +1756,8 @@ DamageRegister(DrawablePtr pDrawable, DamagePtr pDamage)
|
||||||
pDamage->isWindow = FALSE;
|
pDamage->isWindow = FALSE;
|
||||||
pDamage->pDrawable = pDrawable;
|
pDamage->pDrawable = pDrawable;
|
||||||
damageInsertDamage(getDrawableDamageRef(pDrawable), pDamage);
|
damageInsertDamage(getDrawableDamageRef(pDrawable), pDamage);
|
||||||
(*pScrPriv->funcs.Register) (pDrawable, pDamage);
|
if (pScrPriv && pScrPriv->funcs.Register)
|
||||||
|
pScrPriv->funcs.Register(pDrawable, pDamage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1774,7 +1776,10 @@ DamageUnregister(DamagePtr pDamage)
|
||||||
|
|
||||||
damageScrPriv(pScreen);
|
damageScrPriv(pScreen);
|
||||||
|
|
||||||
(*pScrPriv->funcs.Unregister) (pDrawable, pDamage);
|
if (pScrPriv && pScrPriv->funcs.Unregister)
|
||||||
|
pScrPriv->funcs.Unregister(pDrawable, pDamage);
|
||||||
|
else
|
||||||
|
miDamageUnregister(pDrawable, pDamage);
|
||||||
|
|
||||||
if (pDrawable->type == DRAWABLE_WINDOW) {
|
if (pDrawable->type == DRAWABLE_WINDOW) {
|
||||||
WindowPtr pWindow = (WindowPtr) pDrawable;
|
WindowPtr pWindow = (WindowPtr) pDrawable;
|
||||||
|
@ -1817,7 +1822,9 @@ DamageDestroy(DamagePtr pDamage)
|
||||||
|
|
||||||
if (pDamage->damageDestroy)
|
if (pDamage->damageDestroy)
|
||||||
(*pDamage->damageDestroy) (pDamage, pDamage->closure);
|
(*pDamage->damageDestroy) (pDamage, pDamage->closure);
|
||||||
(*pScrPriv->funcs.Destroy) (pDamage);
|
|
||||||
|
if (pScrPriv && pScrPriv->funcs.Destroy)
|
||||||
|
pScrPriv->funcs.Destroy(pDamage);
|
||||||
RegionUninit(&pDamage->damage);
|
RegionUninit(&pDamage->damage);
|
||||||
RegionUninit(&pDamage->pendingDamage);
|
RegionUninit(&pDamage->pendingDamage);
|
||||||
free(pDamage);
|
free(pDamage);
|
||||||
|
|
Loading…
Reference in New Issue