| Index: runtime/vm/dart_api_impl.cc
|
| diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
|
| index e64c399fc4d914d842415daf668676a053903f5d..560b600dc8dcebc0570052d82638731441aed301 100644
|
| --- a/runtime/vm/dart_api_impl.cc
|
| +++ b/runtime/vm/dart_api_impl.cc
|
| @@ -730,7 +730,7 @@ FinalizablePersistentHandle* FinalizablePersistentHandle::Cast(
|
| void FinalizablePersistentHandle::Finalize(
|
| Isolate* isolate, FinalizablePersistentHandle* handle) {
|
| if (!handle->raw()->IsHeapObject()) {
|
| - return;
|
| + return; // Free handle.
|
| }
|
| Dart_WeakPersistentHandleFinalizer callback = handle->callback();
|
| ASSERT(callback != NULL);
|
| @@ -1034,6 +1034,9 @@ static Dart_WeakPersistentHandle AllocateFinalizableHandle(
|
| REUSABLE_OBJECT_HANDLESCOPE(thread);
|
| Object& ref = thread->ObjectHandle();
|
| ref = Api::UnwrapHandle(object);
|
| + if (!ref.raw()->IsHeapObject()) {
|
| + return NULL;
|
| + }
|
| FinalizablePersistentHandle* finalizable_ref =
|
| FinalizablePersistentHandle::New(thread->isolate(),
|
| ref,
|
|
|