OSDN Git Service

Add missing EndAssertNoThreadSuspension
authorMathieu Chartier <mathieuc@google.com>
Wed, 17 Jun 2015 21:14:36 +0000 (14:14 -0700)
committerMathieu Chartier <mathieuc@google.com>
Wed, 17 Jun 2015 21:30:59 +0000 (14:30 -0700)
(cherry picked from commit a3b9d4eda1ef0845f307891f349eaf752750ac16)

Bug: 21872507
Change-Id: I20f9920e4a12511ce498c252bca955d82a4f4102

runtime/class_linker.cc

index c4d978f..98fa897 100644 (file)
@@ -4894,6 +4894,9 @@ bool ClassLinker::LinkInterfaceMethods(Thread* self, Handle<mirror::Class> klass
           if (interface_name_comparator.HasSameNameAndSignature(
               vtable_method_for_name_comparison)) {
             if (!vtable_method->IsAbstract() && !vtable_method->IsPublic()) {
+              // Must do EndAssertNoThreadSuspension before throw since the throw can cause
+              // allocations.
+              self->EndAssertNoThreadSuspension(old_cause);
               ThrowIllegalAccessError(klass.Get(),
                   "Method '%s' implementing interface method '%s' is not public",
                   PrettyMethod(vtable_method).c_str(), PrettyMethod(interface_method).c_str());