Index: mojo/dart/embedder/dart_controller.cc |
diff --git a/mojo/dart/embedder/dart_controller.cc b/mojo/dart/embedder/dart_controller.cc |
index 6ffac3d5ea55b837e12333c3401939e980e4acde..f85e1c42a0ce489365c723543b2d6112f5a4e848 100644 |
--- a/mojo/dart/embedder/dart_controller.cc |
+++ b/mojo/dart/embedder/dart_controller.cc |
@@ -13,6 +13,7 @@ |
#include "mojo/dart/embedder/builtin.h" |
#include "mojo/dart/embedder/dart_controller.h" |
#include "mojo/dart/embedder/isolate_data.h" |
+#include "mojo/public/c/system/core.h" |
namespace mojo { |
namespace dart { |
@@ -429,6 +430,13 @@ static void UnhandledExceptionCallback(Dart_Handle error) { |
// for clients if we pass any error string here instead. |
isolate_data->callbacks.exception.Run(error); |
} |
+ |
+ // Close handles generated by the isolate. |
+ std::set<int64_t>& handles = isolate_data->unclosed_handles; |
+ for (auto it = handles.begin(); it != handles.end(); ++it) { |
+ MojoClose(static_cast<MojoHandle>(*it)); |
+ } |
+ handles.clear(); |
} |