diff options
Diffstat (limited to 'oatdump/oatdump.cc')
-rw-r--r-- | oatdump/oatdump.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc index de4ea36..931cca7 100644 --- a/oatdump/oatdump.cc +++ b/oatdump/oatdump.cc @@ -1968,13 +1968,13 @@ static int DumpOatWithRuntime(Runtime* runtime, OatFile* oat_file, OatDumperOpti ScopedObjectAccess soa(self); ClassLinker* class_linker = runtime->GetClassLinker(); class_linker->RegisterOatFile(oat_file); - std::vector<const DexFile*> dex_files; + std::vector<std::unique_ptr<const DexFile>> dex_files; for (const OatFile::OatDexFile* odf : oat_file->GetOatDexFiles()) { std::string error_msg; - const DexFile* dex_file = odf->OpenDexFile(&error_msg); + std::unique_ptr<const DexFile> dex_file = odf->OpenDexFile(&error_msg); CHECK(dex_file != nullptr) << error_msg; class_linker->RegisterDexFile(*dex_file); - dex_files.push_back(dex_file); + dex_files.push_back(std::move(dex_file)); } // Need a class loader. @@ -1983,7 +1983,11 @@ static int DumpOatWithRuntime(Runtime* runtime, OatFile* oat_file, OatDumperOpti soa.Env()->AllocObject(WellKnownClasses::dalvik_system_PathClassLoader)); jobject class_loader = soa.Env()->NewGlobalRef(class_loader_local.get()); // Fake that we're a compiler. - runtime->SetCompileTimeClassPath(class_loader, dex_files); + std::vector<const DexFile*> class_path; + for (auto& dex_file : dex_files) { + class_path.push_back(dex_file.get()); + } + runtime->SetCompileTimeClassPath(class_loader, class_path); // Use the class loader while dumping. StackHandleScope<1> scope(self); |