summaryrefslogtreecommitdiffstats
path: root/webkit/glue/image_resource_fetcher.cc
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-20 20:35:56 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-20 20:35:56 +0000
commit0fd62c4931b34903e60ab3c82d2cddcea89f8199 (patch)
treefc73e7bb56296e06b1a67aaa312c9854af080b32 /webkit/glue/image_resource_fetcher.cc
parentee2a62078e0a3c44628a80337d6b548883071c5a (diff)
downloadchromium_src-0fd62c4931b34903e60ab3c82d2cddcea89f8199.zip
chromium_src-0fd62c4931b34903e60ab3c82d2cddcea89f8199.tar.gz
chromium_src-0fd62c4931b34903e60ab3c82d2cddcea89f8199.tar.bz2
Fix a potential crash by clearing callback_ before running it.
R=tony BUG=69592 Review URL: http://codereview.chromium.org/6325012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71995 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/image_resource_fetcher.cc')
-rw-r--r--webkit/glue/image_resource_fetcher.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/webkit/glue/image_resource_fetcher.cc b/webkit/glue/image_resource_fetcher.cc
index 1396aa3..b6f6620 100644
--- a/webkit/glue/image_resource_fetcher.cc
+++ b/webkit/glue/image_resource_fetcher.cc
@@ -47,8 +47,12 @@ void ImageResourceFetcher::OnURLFetchComplete(
// 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