Commit b480adfa authored by Charmaine Lee's avatar Charmaine Lee

st/mesa: purge framebuffers with current context after unbinding winsys buffers

With commit c89e8470, framebuffers are purged after unbinding context,
but this change also introduces a heap corruption when running Rhino application
on VMware svga device. Instead of purging the framebuffers after the context
is unbound, this patch first ubinds the winsys buffers, then purges the framebuffers
with the current context, and then finally unbinds the context.

This fixes heap corruption.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Brian Paul's avatarBrian Paul <brianp@vmware.com>
parent 7e5723d6
......@@ -1105,10 +1105,17 @@ st_api_make_current(struct st_api *stapi, struct st_context_iface *stctxi,
else {
GET_CURRENT_CONTEXT(ctx);
ret = _mesa_make_current(NULL, NULL, NULL);
if (ctx)
if (ctx) {
/* Before releasing the context, release its associated
* winsys buffers first. Then purge the context's winsys buffers list
* to free the resources of any winsys buffers that no longer have
* an existing drawable.
*/
ret = _mesa_make_current(ctx, NULL, NULL);
st_framebuffers_purge(ctx->st);
}
ret = _mesa_make_current(NULL, NULL, NULL);
}
return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment