| Index: mojo/public/platform/dart/dart_handle_watcher.cc
|
| diff --git a/mojo/public/platform/dart/dart_handle_watcher.cc b/mojo/public/platform/dart/dart_handle_watcher.cc
|
| index 9720407c3c3c6abda6d467b952852a1c3055b9db..46e0504fca6ce17aecadda6c96341e246807784c 100644
|
| --- a/mojo/public/platform/dart/dart_handle_watcher.cc
|
| +++ b/mojo/public/platform/dart/dart_handle_watcher.cc
|
| @@ -168,7 +168,14 @@ void HandleWatcherThreadState::AddHandle(MojoHandle handle,
|
|
|
| void HandleWatcherThreadState::RemoveHandle(MojoHandle handle) {
|
| auto it = handle_to_index_map_.find(handle);
|
| - MOJO_CHECK(it != handle_to_index_map_.end());
|
| +
|
| + // Removal of a handle for an incoming event can race with the removal of
|
| + // a handle for an unsubscribe() call on the Dart MojoEventSubscription.
|
| + // This is not an error, so we ignore attempts to remove a handle that is not
|
| + // in the map.
|
| + if (it == handle_to_index_map_.end()) {
|
| + return;
|
| + }
|
| const intptr_t index = it->second;
|
| // We should never be removing the control handle.
|
| MOJO_CHECK(index != CONTROL_HANDLE_INDEX);
|
|
|