Chromium Code Reviews| Index: runtime/vm/port.cc |
| diff --git a/runtime/vm/port.cc b/runtime/vm/port.cc |
| index 2541b38079e10746ef0eadfddee18fb6a2380716..d5513d598ac2c984a3751775d3dbd0fced91f909 100644 |
| --- a/runtime/vm/port.cc |
| +++ b/runtime/vm/port.cc |
| @@ -216,7 +216,8 @@ bool PortMap::ClosePort(Dart_Port port) { |
| } |
| handler->ClosePort(port); |
| if (!handler->HasLivePorts() && handler->OwnedByPortMap()) { |
| - delete handler; |
| + // Delete handler as soon as it isn't busy with a task. |
| + handler->RequestDeletion(); |
| } |
| return true; |
| } |