mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 22:38:05 +02:00
[texenvprogram] Fix refcounting-related memory leak.
All newly created programs have RefCount == 1, but the fragment program cache added an additional reference in cache_item, with the result being that none of the programs were ever freed. Solve the problem by not creating the additional reference in cache_item.
This commit is contained in:
parent
7ead1c5d06
commit
934a53eb44
1 changed files with 2 additions and 1 deletions
|
|
@ -1204,7 +1204,7 @@ static void cache_item( GLcontext *ctx,
|
|||
c->key = _mesa_malloc(sizeof(*key));
|
||||
memcpy(c->key, key, sizeof(*key));
|
||||
|
||||
_mesa_reference_fragprog(ctx, &c->data, prog);
|
||||
c->data = prog;
|
||||
|
||||
if (cache->n_items > cache->size * 1.5) {
|
||||
if (cache->size < 1000)
|
||||
|
|
@ -1271,6 +1271,7 @@ _mesa_UpdateTexEnvProgram( GLcontext *ctx )
|
|||
|
||||
create_new_program(ctx, &key, newProg);
|
||||
|
||||
/* Our ownership of newProg is transferred to the cache */
|
||||
cache_item(ctx, &ctx->Texture.env_fp_cache, hash, &key, newProg);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue