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

Unified Diff: third_party/WebKit/Source/core/fetch/RawResource.cpp

Issue 2005743002: Check RawResourceClient destruction in RawResource::didAddClient() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 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 | « third_party/WebKit/Source/core/fetch/RawResource.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/fetch/RawResource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/RawResource.cpp b/third_party/WebKit/Source/core/fetch/RawResource.cpp
index 4812927f5af260cc29864eb5d5b145c0b318feb5..465fdc24b298b6025f67d4ad35fa8e9f1f9a46a8 100644
--- a/third_party/WebKit/Source/core/fetch/RawResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/RawResource.cpp
@@ -105,20 +105,21 @@ void RawResource::didAddClient(ResourceClient* c)
return;
ASSERT(RawResourceClient::isExpectedType(c));
RawResourceClient* client = static_cast<RawResourceClient*>(c);
+ WeakPtr<RawResourceClient> clientWeak = client->createWeakPtr();
for (const auto& redirect : redirectChain()) {
ResourceRequest request(redirect.m_request);
client->redirectReceived(this, request, redirect.m_redirectResponse);
- if (!hasClient(c))
+ if (!clientWeak || !hasClient(c))
return;
}
if (!m_response.isNull())
client->responseReceived(this, m_response, nullptr);
- if (!hasClient(c))
+ if (!clientWeak || !hasClient(c))
return;
if (m_data)
client->dataReceived(this, m_data->data(), m_data->size());
- if (!hasClient(c))
+ if (!clientWeak || !hasClient(c))
return;
Resource::didAddClient(client);
}
« no previous file with comments | « third_party/WebKit/Source/core/fetch/RawResource.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698