diff options
author | Benjamin Franzke <[email protected]> | 2011-02-09 20:42:50 +0100 |
---|---|---|
committer | Kristian Høgsberg <[email protected]> | 2011-02-10 23:07:01 -0500 |
commit | 0acb31be171f01aec8b38ceaddf47b7da6dae2a0 (patch) | |
tree | f477f5e686c8ac99a94fbf338ccc698f7f29f531 | |
parent | c79a5a706727c40a856e36c043da608c825390a2 (diff) |
st/dri: Fix surfaceless gl using contexts with previous bound surfaces
ctx->dPriv might be != NULL then draw which is NULL is accessed:
struct dri_drawable *draw = dri_drawable(driDrawPriv);
[..]
if (ctx->dPriv != driDrawPriv) {
ctx->dPriv = driDrawPriv;
draw->texture_stamp = driDrawPriv->lastStamp - 1;
}
-rw-r--r-- | src/gallium/state_trackers/dri/common/dri_context.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/dri/common/dri_context.c b/src/gallium/state_trackers/dri/common/dri_context.c index 3d5d24e692c..999b41152e1 100644 --- a/src/gallium/state_trackers/dri/common/dri_context.c +++ b/src/gallium/state_trackers/dri/common/dri_context.c @@ -169,6 +169,11 @@ dri_make_current(__DRIcontext * cPriv, ++ctx->bind_count; + if (!driDrawPriv && !driReadPriv) + return ctx->stapi->make_current(ctx->stapi, ctx->st, NULL, NULL); + else if (!driDrawPriv || !driReadPriv) + return GL_FALSE; + if (ctx->dPriv != driDrawPriv) { ctx->dPriv = driDrawPriv; draw->texture_stamp = driDrawPriv->lastStamp - 1; @@ -178,8 +183,7 @@ dri_make_current(__DRIcontext * cPriv, read->texture_stamp = driReadPriv->lastStamp - 1; } - ctx->stapi->make_current(ctx->stapi, ctx->st, - (draw) ? &draw->base : NULL, (read) ? &read->base : NULL); + ctx->stapi->make_current(ctx->stapi, ctx->st, &draw->base, &read->base); return GL_TRUE; } |