Permalink
Browse files

Initialize target class in setObjectClassNative()

This is usually done in the constructor, but as we don't call it, the
target class stays in status CLASS_RESOLVED. Java calls don't care about
this, but it's checked in JNI, causing crashes in a few apps.
  • Loading branch information...
rovo89 committed May 19, 2014
1 parent 26447fb commit e71b632817d76b37f57f5b7cc3c39053f2d2e29c
Showing with 5 additions and 1 deletion.
  1. +4 −0 xposed.cpp
  2. +1 −1 xposed.h
View
@@ -613,6 +613,10 @@ static jobject de_robv_android_xposed_XposedBridge_getStartClassName(JNIEnv* env
static void de_robv_android_xposed_XposedBridge_setObjectClassNative(JNIEnv* env, jclass clazz, jobject objIndirect, jclass clzIndirect) {
Object* obj = (Object*) dvmDecodeIndirectRef(dvmThreadSelf(), objIndirect);
ClassObject* clz = (ClassObject*) dvmDecodeIndirectRef(dvmThreadSelf(), clzIndirect);
+ if (clz->status < CLASS_INITIALIZED && !dvmInitClass(clz)) {
+ ALOGE("Could not initialize class %s", clz->descriptor);
+ return;
+ }
obj->clazz = clz;
}
View
@@ -22,7 +22,7 @@ namespace android {
#define MIUI_RESOURCES_CLASS "android/content/res/MiuiResources"
#define XTYPEDARRAY_CLASS "android/content/res/XResources$XTypedArray"
-#define XPOSED_VERSION "57"
+#define XPOSED_VERSION "58"
#ifndef ALOGD
#define ALOGD LOGD

0 comments on commit e71b632

Please sign in to comment.