Skip to content

Commit

Permalink
Copy the callback in DhcpProxyScriptFetcherChromeos
Browse files Browse the repository at this point in the history
This was careless of me, we need to bind a copy of the Callback, not the
reference in PostTaskAndReplyWithResult.

BUG=289137

Review URL: https://chromiumcodereview.appspot.com/23880009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222843 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
stevenjb@chromium.org committed Sep 12, 2013
1 parent e83eca1 commit c310432
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion chromeos/network/dhcp_proxy_script_fetcher_chromeos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ int DhcpProxyScriptFetcherChromeos::Fetch(
const net::CompletionCallback& callback) {
if (!network_handler_message_loop_.get())
return net::ERR_PAC_NOT_IN_DHCP;
CHECK(!callback.is_null());
base::PostTaskAndReplyWithResult(
network_handler_message_loop_.get(),
FROM_HERE,
Expand All @@ -60,6 +61,8 @@ int DhcpProxyScriptFetcherChromeos::Fetch(

void DhcpProxyScriptFetcherChromeos::Cancel() {
proxy_script_fetcher_->Cancel();
// Invalidate any pending callbacks (i.e. calls to ContinueFetch).
weak_ptr_factory_.InvalidateWeakPtrs();
}

const GURL& DhcpProxyScriptFetcherChromeos::GetPacURL() const {
Expand All @@ -72,7 +75,7 @@ std::string DhcpProxyScriptFetcherChromeos::GetFetcherName() const {

void DhcpProxyScriptFetcherChromeos::ContinueFetch(
base::string16* utf16_text,
const net::CompletionCallback& callback,
net::CompletionCallback callback,
std::string pac_url) {
NET_LOG_EVENT("DhcpProxyScriptFetcher", pac_url);
pac_url_ = GURL(pac_url);
Expand Down
2 changes: 1 addition & 1 deletion chromeos/network/dhcp_proxy_script_fetcher_chromeos.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CHROMEOS_EXPORT DhcpProxyScriptFetcherChromeos

private:
void ContinueFetch(base::string16* utf16_text,
const net::CompletionCallback& callback,
net::CompletionCallback callback,
std::string pac_url);

net::URLRequestContext* url_request_context_; // Weak ptr
Expand Down

0 comments on commit c310432

Please sign in to comment.