Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Unified Diff: content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc

Issue 102823002: Fix possible use-after-free in WGC3D shared context map (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
index 1a8deabeca67490a8ea51a162f9757d16862c86b..2d7bddbcd6c2e3998a51515787c2ae8257ed1fe7 100644
--- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
+++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
@@ -239,17 +239,6 @@ WebGraphicsContext3DCommandBufferImpl::
real_gl_->SetErrorMessageCallback(NULL);
}
- if (host_.get()) {
- base::AutoLock lock(g_all_shared_contexts_lock.Get());
- ContextMap& all_contexts = g_all_shared_contexts.Get();
- ContextMap::iterator it = std::find(
- all_contexts.begin(),
- all_contexts.end(),
- std::pair<GpuChannelHost* const,
- WebGraphicsContext3DCommandBufferImpl*>(host_.get(), this));
- if (it != all_contexts.end())
- all_contexts.erase(it);
- }
Destroy();
}
@@ -455,6 +444,18 @@ uint32_t WebGraphicsContext3DCommandBufferImpl::lastFlushID() {
DELEGATE_TO_GL_R(insertSyncPoint, InsertSyncPointCHROMIUM, unsigned int)
void WebGraphicsContext3DCommandBufferImpl::Destroy() {
+ if (host_.get()) {
+ base::AutoLock lock(g_all_shared_contexts_lock.Get());
+ ContextMap& all_contexts = g_all_shared_contexts.Get();
+ ContextMap::iterator it = std::find(
+ all_contexts.begin(),
+ all_contexts.end(),
+ std::pair<GpuChannelHost* const,
+ WebGraphicsContext3DCommandBufferImpl*>(host_.get(), this));
+ if (it != all_contexts.end())
+ all_contexts.erase(it);
+ }
+
if (gl_) {
// First flush the context to ensure that any pending frees of resources
// are completed. Otherwise, if this context is part of a share group,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698