Various runtime/JNI related fixes.
NewObject returns NULL if exception is thrown in constructor.
Allocate the peer then call constructor to ensure peer_ field is
initialized.
Change thread state for AddFinalizer and pass current thread through for
ease.
Change-Id: Ib578b6d44b08aef10fde5d8bc27cc6a2acbf6fae
diff --git a/src/object.cc b/src/object.cc
index 2bb6d2d..9cc0e3a 100644
--- a/src/object.cc
+++ b/src/object.cc
@@ -43,7 +43,7 @@
memcpy(dst_bytes + offset, src_bytes + offset, num_bytes - offset);
if (c->IsFinalizable()) {
- Heap::AddFinalizerReference(copy.get());
+ Heap::AddFinalizerReference(Thread::Current(), copy.get());
}
return copy.get();