From 8e41b1247ffb30f175879a975435c263ff4e56af Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Thu, 5 Jan 2023 13:54:56 +0000 Subject: Move one ObjPtr use to Handle. The passed function being called might suspend, so make sure the `long_array` is in a handle. Test: test.py Bug: 262438759 Change-Id: I7ab179bebd881a76f42623992f44e3fd9242b6a2 --- runtime/class_loader_utils.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'runtime/class_loader_utils.h') diff --git a/runtime/class_loader_utils.h b/runtime/class_loader_utils.h index 908d06225b..6868b3f38a 100644 --- a/runtime/class_loader_utils.h +++ b/runtime/class_loader_utils.h @@ -118,7 +118,9 @@ inline RetType VisitClassLoaderDexFiles(Thread* self, REQUIRES_SHARED(Locks::mutator_lock_) { ObjPtr dex_file = dex_file_field->GetObject(element); if (dex_file != nullptr) { - ObjPtr long_array = cookie_field->GetObject(dex_file)->AsLongArray(); + StackHandleScope<1> hs(self); + Handle long_array = + hs.NewHandle(cookie_field->GetObject(dex_file)->AsLongArray()); if (long_array == nullptr) { // This should never happen so log a warning. LOG(WARNING) << "Null DexFile::mCookie"; -- cgit v1.2.3-59-g8ed1b