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; |
} |