Index: libadblockplus-android/jni/JniLogSystem.cpp |
diff --git a/libadblockplus-android/jni/JniLogSystem.cpp b/libadblockplus-android/jni/JniLogSystem.cpp |
index 002775cded976091063e50842dbf5101e6963039..d537a685bdc7dd7dc7fb10d64efcbed65aa3a5df 100644 |
--- a/libadblockplus-android/jni/JniLogSystem.cpp |
+++ b/libadblockplus-android/jni/JniLogSystem.cpp |
@@ -16,6 +16,24 @@ |
*/ |
#include "JniCallbacks.h" |
+#include "JniLogSystem.h" |
+ |
+// precached in JNI_OnLoad and released in JNI_OnUnload |
+JniGlobalReference<jclass>* logLevelClass; |
+ |
+void JniLogSystem_OnLoad(JavaVM* vm, JNIEnv* env, void* reserved) |
+{ |
+ logLevelClass = new JniGlobalReference<jclass>(env, env->FindClass(PKG("LogSystem$LogLevel"))); |
+} |
+ |
+void JniLogSystem_OnUnload(JavaVM* vm, JNIEnv* env, void* reserved) |
+{ |
+ if (logLevelClass) |
+ { |
+ delete logLevelClass; |
+ logLevelClass = NULL; |
+ } |
+} |
static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jobject callbackObject) |
{ |
@@ -32,7 +50,7 @@ static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr) |
} |
JniLogSystemCallback::JniLogSystemCallback(JNIEnv* env, jobject callbackObject) |
- : JniCallbackBase(env, callbackObject), AdblockPlus::LogSystem(), logLevelClass(new JniGlobalReference<jclass>(env, env->FindClass(PKG("LogSystem$LogLevel")))) |
+ : JniCallbackBase(env, callbackObject), AdblockPlus::LogSystem() |
{ |
} |