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

Unified Diff: mojo/public/platform/dart/dart_handle_watcher.cc

Issue 1874553002: Dart: Fix bug in unbind() for Stubs. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 8 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 | « mojo/dart/packages/_mojo_for_test_only/lib/test/echo_service.mojom.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « mojo/dart/packages/_mojo_for_test_only/lib/test/echo_service.mojom.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698