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

Unified Diff: extensions/browser/api/cast_channel/cast_socket.cc

Issue 2707543002: [Cast Channel] Fix "leaky" CastChannelOpenFunction. (Closed)
Patch Set: Created 3 years, 10 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 | « extensions/browser/api/cast_channel/cast_socket.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/cast_channel/cast_socket.cc
diff --git a/extensions/browser/api/cast_channel/cast_socket.cc b/extensions/browser/api/cast_channel/cast_socket.cc
index 483b4f9795c8801ea9d9281b6af3631eae2820ce..921579e11dde62072d96cf1f63ac986790e0ea63 100644
--- a/extensions/browser/api/cast_channel/cast_socket.cc
+++ b/extensions/browser/api/cast_channel/cast_socket.cc
@@ -136,9 +136,12 @@ CastSocketImpl::CastSocketImpl(const std::string& owner_extension_id,
}
CastSocketImpl::~CastSocketImpl() {
- // Ensure that resources are freed but do not run pending callbacks to avoid
- // any re-entrancy.
+ // Ensure that resources are freed but do not run pending callbacks that
+ // would result in re-entrancy.
CloseInternal();
+
+ if (!connect_callback_.is_null())
+ base::ResetAndReturn(&connect_callback_).Run(CHANNEL_ERROR_UNKNOWN);
}
ReadyState CastSocketImpl::ready_state() const {
« no previous file with comments | « extensions/browser/api/cast_channel/cast_socket.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698