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

Unified Diff: webkit/glue/image_resource_fetcher.cc

Issue 6325012: Fix a potential crash by clearing callback_ before running it.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months 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 | webkit/glue/resource_fetcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/image_resource_fetcher.cc
===================================================================
--- webkit/glue/image_resource_fetcher.cc (revision 71961)
+++ webkit/glue/image_resource_fetcher.cc (working copy)
@@ -47,8 +47,12 @@
// If we get here, it means no image from server or couldn't decode the
// response as an image. The delegate will see a null image, indicating
// that an error occurred.
- callback_->Run(this, bitmap);
- callback_.reset();
+
+ // Take care to clear callback_ before running the callback as it may lead to
+ // our destruction.
+ scoped_ptr<Callback> callback;
+ callback.swap(callback_);
+ callback->Run(this, bitmap);
}
} // namespace webkit_glue
« no previous file with comments | « no previous file | webkit/glue/resource_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698