summaryrefslogtreecommitdiff
path: root/runtime/class_loader_utils.h
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2023-01-05 13:54:56 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2023-01-09 09:44:08 +0000
commit8e41b1247ffb30f175879a975435c263ff4e56af (patch)
tree2b4b6f87dfde9e881b858d981b44bf7121822d10 /runtime/class_loader_utils.h
parent3898205167cfc885c6bb6bc1ef31f2bb63817772 (diff)
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
Diffstat (limited to 'runtime/class_loader_utils.h')
-rw-r--r--runtime/class_loader_utils.h4
1 files changed, 3 insertions, 1 deletions
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<mirror::Object> dex_file = dex_file_field->GetObject(element);
if (dex_file != nullptr) {
- ObjPtr<mirror::LongArray> long_array = cookie_field->GetObject(dex_file)->AsLongArray();
+ StackHandleScope<1> hs(self);
+ Handle<mirror::LongArray> 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";