Fix the SIGSEGV caused by premature initialization of ClassLinker (#137)

ClassLinker should be initialized after Class because FixupStaticTrampolines references Class::GetClassDef, causing a SIGSEGV.
This commit is contained in:
烂泥扶上墙 2025-02-26 19:29:45 +08:00 committed by GitHub
parent 90d8d433d4
commit 8c3c6e6b2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -268,14 +268,14 @@ bool InitNative(JNIEnv *env, const HookHandler &handler) {
LOGE("Failed to init thread"); LOGE("Failed to init thread");
return false; return false;
} }
if (!ClassLinker::Init(handler)) {
LOGE("Failed to init class linker");
return false;
}
if (!Class::Init(handler)) { if (!Class::Init(handler)) {
LOGE("Failed to init mirror class"); LOGE("Failed to init mirror class");
return false; return false;
} }
if (!ClassLinker::Init(handler)) {
LOGE("Failed to init class linker");
return false;
}
if (!ScopedSuspendAll::Init(handler)) { if (!ScopedSuspendAll::Init(handler)) {
LOGE("Failed to init scoped suspend all"); LOGE("Failed to init scoped suspend all");
return false; return false;