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

Unified Diff: runtime/vm/native_api_impl.cc

Issue 2200903002: Fix NativeMessageHandler leak (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | runtime/vm/native_message_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/native_api_impl.cc
diff --git a/runtime/vm/native_api_impl.cc b/runtime/vm/native_api_impl.cc
index 1bc5d4c2305f1d2287cd453a3914ea8fae786e74..dd4350cc6e5f52552221efdb5e6ad8dcdc7f6c02 100644
--- a/runtime/vm/native_api_impl.cc
+++ b/runtime/vm/native_api_impl.cc
@@ -90,6 +90,9 @@ DART_EXPORT Dart_Port Dart_NewNativePort(const char* name,
NativeMessageHandler* nmh = new NativeMessageHandler(name, handler);
Dart_Port port_id = PortMap::CreatePort(nmh);
+ // Mark that the port is a live port so that PortMap::ClosePort decrements
+ // the live port count when it is closed.
+ PortMap::SetPortState(port_id, PortMap::kLivePort);
nmh->Run(Dart::thread_pool(), NULL, NULL, 0);
return port_id;
}
« no previous file with comments | « no previous file | runtime/vm/native_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698