diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2007-08-14 11:39:26 -0400 |
---|---|---|
committer | Eamon Walsh <ewalsh@moss-charon.epoch.ncsc.mil> | 2007-08-14 11:39:26 -0400 |
commit | 9a183d7ba50e31afa133cc03aee7991517a283ea (patch) | |
tree | a77da3210253f96d5d0be97a8a321920648ca81f /dix | |
parent | 2763056ab5ae31bed422a0948198d98c6ace6d55 (diff) |
dix: remove caching of drawables and graphics contexts. The security checks
simply bypass the cached values so they are unused.
Diffstat (limited to 'dix')
-rw-r--r-- | dix/dispatch.c | 43 | ||||
-rw-r--r-- | dix/dixutils.c | 22 | ||||
-rw-r--r-- | dix/resource.c | 20 |
3 files changed, 5 insertions, 80 deletions
diff --git a/dix/dispatch.c b/dix/dispatch.c index 1c40e2fcb..69b1922d3 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -258,34 +258,6 @@ InitSelections(void) CurrentSelections = (Selection *)NULL; NumCurrentSelections = 0; } - -void -FlushClientCaches(XID id) -{ - int i; - ClientPtr client; - - client = clients[CLIENT_ID(id)]; - if (client == NullClient) - return ; - for (i=0; i<currentMaxClients; i++) - { - client = clients[i]; - if (client != NullClient) - { - if (client->lastDrawableID == id) - { - client->lastDrawableID = WindowTable[0]->drawable.id; - client->lastDrawable = (DrawablePtr)WindowTable[0]; - } - else if (client->lastGCID == id) - { - client->lastGCID = INVALID; - client->lastGC = (GCPtr)NULL; - } - } - } -} #ifdef SMART_SCHEDULE #undef SMART_DEBUG @@ -3702,20 +3674,7 @@ void InitClient(ClientPtr client, int i, pointer ospriv) client->sequence = 0; client->clientAsMask = ((Mask)i) << CLIENTOFFSET; client->clientGone = FALSE; - if (i) - { - client->closeDownMode = DestroyAll; - client->lastDrawable = (DrawablePtr)WindowTable[0]; - client->lastDrawableID = WindowTable[0]->drawable.id; - } - else - { - client->closeDownMode = RetainPermanent; - client->lastDrawable = (DrawablePtr)NULL; - client->lastDrawableID = INVALID; - } - client->lastGC = (GCPtr) NULL; - client->lastGCID = INVALID; + client->closeDownMode = i ? DestroyAll : RetainPermanent; client->numSaved = 0; client->saveSet = (SaveSetElt *)NULL; client->noClientException = Success; diff --git a/dix/dixutils.c b/dix/dixutils.c index 14ef7e674..e8d7daf06 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -208,7 +208,6 @@ dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client, Mask type, Mask access) { DrawablePtr pTmp; - RESTYPE rtype; int rc; *pDraw = NULL; @@ -217,28 +216,15 @@ dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client, if (id == INVALID) return BadDrawable; - if (id == client->lastDrawableID) { - pTmp = client->lastDrawable; + rc = dixLookupResource((pointer *)&pTmp, id, RC_DRAWABLE, client, access); - /* an access check is required for cached drawables */ - rtype = (type & M_WINDOW) ? RT_WINDOW : RT_PIXMAP; - rc = XaceHook(XACE_RESOURCE_ACCESS, client, id, rtype, access, pTmp); - if (rc != Success) - return rc; - } else - dixLookupResource((void **)&pTmp, id, RC_DRAWABLE, client, access); - - if (!pTmp) + if (rc == BadValue) return BadDrawable; + if (rc != Success) + return rc; if (!((1 << pTmp->type) & (type ? type : M_DRAWABLE))) return BadMatch; - if (type & M_DRAWABLE) { - client->lastDrawable = pTmp; - client->lastDrawableID = id; - client->lastGCID = INVALID; - client->lastGC = (GCPtr)NULL; - } *pDraw = pTmp; return Success; } diff --git a/dix/resource.c b/dix/resource.c index ea0a3105c..844d12ec0 100644 --- a/dix/resource.c +++ b/dix/resource.c @@ -585,8 +585,6 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType) CallResourceStateCallback(ResourceStateFreeing, res); - if (rtype & RC_CACHED) - FlushClientCaches(res->id); if (rtype != skipDeleteFuncType) (*DeleteFuncs[rtype & TypeMask])(res->value, res->id); xfree(res); @@ -597,11 +595,6 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType) else prev = &res->next; } - if(clients[cid] && (id == clients[cid]->lastDrawableID)) - { - clients[cid]->lastDrawable = (DrawablePtr)WindowTable[0]; - clients[cid]->lastDrawableID = WindowTable[0]->drawable.id; - } } if (!gotOne) ErrorF("Freeing resource id=%lX which isn't there.\n", @@ -632,8 +625,6 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree) CallResourceStateCallback(ResourceStateFreeing, res); - if (type & RC_CACHED) - FlushClientCaches(res->id); if (!skipFree) (*DeleteFuncs[type & TypeMask])(res->value, res->id); xfree(res); @@ -642,11 +633,6 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree) else prev = &res->next; } - if(clients[cid] && (id == clients[cid]->lastDrawableID)) - { - clients[cid]->lastDrawable = (DrawablePtr)WindowTable[0]; - clients[cid]->lastDrawableID = WindowTable[0]->drawable.id; - } } } @@ -669,8 +655,6 @@ ChangeResourceValue (XID id, RESTYPE rtype, pointer value) for (; res; res = res->next) if ((res->id == id) && (res->type == rtype)) { - if (rtype & RC_CACHED) - FlushClientCaches(res->id); res->value = value; return TRUE; } @@ -801,8 +785,6 @@ FreeClientNeverRetainResources(ClientPtr client) CallResourceStateCallback(ResourceStateFreeing, this); - if (rtype & RC_CACHED) - FlushClientCaches(this->id); (*DeleteFuncs[rtype & TypeMask])(this->value, this->id); xfree(this); } @@ -854,8 +836,6 @@ FreeClientResources(ClientPtr client) CallResourceStateCallback(ResourceStateFreeing, this); - if (rtype & RC_CACHED) - FlushClientCaches(this->id); (*DeleteFuncs[rtype & TypeMask])(this->value, this->id); xfree(this); } |