summaryrefslogtreecommitdiff
path: root/src/mesa/tnl/t_context.c
diff options
context:
space:
mode:
authorAapo Tahkola <aet@rasterburn.org>2005-11-01 15:43:06 +0000
committerAapo Tahkola <aet@rasterburn.org>2005-11-01 15:43:06 +0000
commit3cf156df2b5561d52f3bdddf857fcc176e4134b5 (patch)
tree18c0ba8fda445b8169570161a4bd4553ac7d6185 /src/mesa/tnl/t_context.c
parentda70bc6baa3801be7d0210adcbac500d50a2204c (diff)
Fix segmentation fault in _tnl_ProgramCacheDestroy().
Diffstat (limited to 'src/mesa/tnl/t_context.c')
-rw-r--r--src/mesa/tnl/t_context.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index cda4cf2cbd..ded62aee59 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -87,10 +87,19 @@ _tnl_CreateContext( GLcontext *ctx )
_tnl_array_init( ctx );
_tnl_vtx_init( ctx );
- if (ctx->_MaintainTnlProgram)
+ if (ctx->_MaintainTnlProgram) {
+ tnl->vp_cache = MALLOC(sizeof(*tnl->vp_cache));
+ tnl->vp_cache->size = 5;
+ tnl->vp_cache->n_items = 0;
+ tnl->vp_cache->items = MALLOC(tnl->vp_cache->size *
+ sizeof(*tnl->vp_cache->items));
+ _mesa_memset(tnl->vp_cache->items, 0, tnl->vp_cache->size *
+ sizeof(*tnl->vp_cache->items));
+
_tnl_install_pipeline( ctx, _tnl_vp_pipeline );
- else
+ } else {
_tnl_install_pipeline( ctx, _tnl_default_pipeline );
+ }
/* Initialize the arrayelt helper
*/
@@ -135,7 +144,8 @@ _tnl_DestroyContext( GLcontext *ctx )
_tnl_destroy_pipeline( ctx );
_ae_destroy_context( ctx );
- _tnl_ProgramCacheDestroy( ctx );
+ if (ctx->_MaintainTnlProgram)
+ _tnl_ProgramCacheDestroy( ctx );
FREE(tnl);
ctx->swtnl_context = NULL;