Index: mojo/dart/embedder/dart_controller.cc |
diff --git a/mojo/dart/embedder/dart_controller.cc b/mojo/dart/embedder/dart_controller.cc |
index 03bd10f67271fa7c95e1bd4761507eb38e776d9a..91775a0c6ea63a05e429e289cbaa514103ca0ec6 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<MojoHandle>& handles = isolate_data->unclosed_handles; |
+ for (auto it = handles.begin(); it != handles.end(); ++it) { |
+ MojoClose((*it)); |
+ } |
+ handles.clear(); |
} |