From 74fea9e2b9c0a31276b05d15c43a2512f34436c6 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Thu, 24 Oct 2013 21:43:47 +0000 Subject: [PATCH] Fix memory corruption in browser-initiated CefURLRequests (issue #1118). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1487 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- libcef/browser/browser_urlrequest_impl.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libcef/browser/browser_urlrequest_impl.cc b/libcef/browser/browser_urlrequest_impl.cc index fa88d210c..d52b07deb 100644 --- a/libcef/browser/browser_urlrequest_impl.cc +++ b/libcef/browser/browser_urlrequest_impl.cc @@ -372,7 +372,10 @@ CefURLFetcherDelegate::~CefURLFetcherDelegate() { void CefURLFetcherDelegate::OnURLFetchComplete( const net::URLFetcher* source) { - context_->OnComplete(); + // Complete asynchronously so as not to delete the URLFetcher while it's still + // in the call stack. + base::MessageLoop::current()->PostTask(FROM_HERE, + base::Bind(&CefBrowserURLRequest::Context::OnComplete, context_)); } void CefURLFetcherDelegate::OnURLFetchDownloadProgress(