diff options
author | Brian <brian.paul@tungstengraphics.com> | 2008-02-20 15:09:27 -0700 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2008-02-20 15:09:44 -0700 |
commit | 25ea1901b44107a5bc5351487e18d52d75df8ffd (patch) | |
tree | 6b5255f7342a5fccabdbe0d3c845a0fbb12693af /src/mesa | |
parent | fce61f341faf6a2e1a8497ab963985ddbffa8b0a (diff) |
gallium: replace some ordinary assignments with pipe_reference_texture()
This fixes at least one instance of dereferencing an invalid texture pointer.
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_texture.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index b86f416c9b..ad284170e4 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -76,7 +76,7 @@ st_texture_create(struct st_context *st, GLuint depth0, GLuint compress_byte) { - struct pipe_texture pt; + struct pipe_texture pt, *newtex; assert(target <= PIPE_TEXTURE_CUBE); @@ -95,9 +95,12 @@ st_texture_create(struct st_context *st, pt.depth[0] = depth0; pt.compressed = compress_byte ? 1 : 0; pt.cpp = pt.compressed ? compress_byte : st_sizeof_format(format); - pt.refcount = 1; - return st->pipe->texture_create(st->pipe, &pt); + newtex = st->pipe->texture_create(st->pipe, &pt); + + assert(!newtex || newtex->refcount == 1); + + return newtex; } |