Skip to content

Commit a8f13d7

Browse files
committed
fix(jni): enabled schema list always showed the previous settings
SwitcherSettings helper class cannot be new as static variable, otherwise it will not deinit in the function scope, leading to be the previous settings read in the next time.
1 parent 61eb6d2 commit a8f13d7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/src/main/jni/librime_jni/levers.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,21 @@ class SwitcherSettings {
6767
extern "C" JNIEXPORT jobjectArray JNICALL
6868
Java_com_osfans_trime_core_Rime_getAvailableRimeSchemaList(JNIEnv *env,
6969
jclass /* thiz */) {
70-
static SwitcherSettings switcher;
70+
SwitcherSettings switcher;
7171
return rimeSchemaListToJObjectArray(env, switcher.availableSchemas());
7272
}
7373

7474
extern "C" JNIEXPORT jobjectArray JNICALL
7575
Java_com_osfans_trime_core_Rime_getSelectedRimeSchemaList(JNIEnv *env,
7676
jclass /* thiz */) {
77-
static SwitcherSettings switcher;
77+
SwitcherSettings switcher;
7878
return rimeSchemaListToJObjectArray(env, switcher.selectedSchemas());
7979
}
8080

8181
extern "C" JNIEXPORT jboolean JNICALL
8282
Java_com_osfans_trime_core_Rime_selectRimeSchemas(JNIEnv *env,
8383
jclass /* thiz */,
8484
jobjectArray array) {
85-
static SwitcherSettings switcher;
85+
SwitcherSettings switcher;
8686
return switcher.selectSchemas(stringArrayToStringVector(env, array));
8787
}

0 commit comments

Comments
 (0)