OSDN Git Service

Fix compaction bug in Class_getDeclaredMethodsUnchecked
authorMathieu Chartier <mathieuc@google.com>
Thu, 11 Jun 2015 23:21:42 +0000 (16:21 -0700)
committerMathieu Chartier <mathieuc@google.com>
Fri, 12 Jun 2015 00:12:32 +0000 (17:12 -0700)
Added handle to fix the bug.

(cherry picked from commit b89a8c66e360575d2dc1ec1229235735c56968ff)

Bug: 21638351
Change-Id: I1c3abea33aa825d3a28c1fc5cb415508686ad93e

runtime/native/java_lang_Class.cc

index 94024ef..67dcc9c 100644 (file)
@@ -380,8 +380,8 @@ static jobject Class_getDeclaredMethodInternal(JNIEnv* env, jobject javaThis,
 static jobjectArray Class_getDeclaredMethodsUnchecked(JNIEnv* env, jobject javaThis,
                                                       jboolean publicOnly) {
   ScopedFastNativeObjectAccess soa(env);
-  StackHandleScope<3> hs(soa.Self());
-  auto* klass = DecodeClass(soa, javaThis);
+  StackHandleScope<2> hs(soa.Self());
+  auto klass = hs.NewHandle(DecodeClass(soa, javaThis));
   size_t num_methods = 0;
   for (auto& m : klass->GetVirtualMethods(sizeof(void*))) {
     auto modifiers = m.GetAccessFlags();