Skip to content

Commit

Permalink
Minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
qryxip committed Sep 18, 2024
1 parent aebe2ea commit 80c707b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/voicevox_core_java_api/src/synthesizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ unsafe extern "system" fn Java_jp_hiroshiba_voicevoxcore_Synthesizer_rsLoadVoice
) {
throw_if_err(env, (), |env| {
let model = env
.get_rust_field::<_, _, Arc<crate::voice_model::VoiceModelFile>>(&model, "handle")?
.get_rust_field::<_, _, crate::voice_model::VoiceModelFile>(&model, "handle")?
.clone();
let model = model.read()?;
let internal = env
Expand Down
8 changes: 4 additions & 4 deletions crates/voicevox_core_java_api/src/voice_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use jni::{
JNIEnv,
};

pub(crate) type VoiceModelFile = Closable<voicevox_core::blocking::VoiceModelFile>;
pub(crate) type VoiceModelFile = Arc<Closable<voicevox_core::blocking::VoiceModelFile>>;

impl HasJavaClassIdent for voicevox_core::blocking::VoiceModelFile {
const JAVA_CLASS_IDENT: &str = "VoiceModelFile";
Expand Down Expand Up @@ -38,7 +38,7 @@ unsafe extern "system" fn Java_jp_hiroshiba_voicevoxcore_VoiceModelFile_rsGetId<
) -> jobject {
throw_if_err(env, std::ptr::null_mut(), |env| {
let internal = env
.get_rust_field::<_, _, Arc<VoiceModelFile>>(&this, "handle")?
.get_rust_field::<_, _, VoiceModelFile>(&this, "handle")?
.clone();
let internal = internal.read()?;

Expand All @@ -55,7 +55,7 @@ unsafe extern "system" fn Java_jp_hiroshiba_voicevoxcore_VoiceModelFile_rsGetMet
) -> jobject {
throw_if_err(env, std::ptr::null_mut(), |env| {
let internal = env
.get_rust_field::<_, _, Arc<VoiceModelFile>>(&this, "handle")?
.get_rust_field::<_, _, VoiceModelFile>(&this, "handle")?
.clone();
let internal = internal.read()?;

Expand All @@ -71,7 +71,7 @@ unsafe extern "system" fn Java_jp_hiroshiba_voicevoxcore_VoiceModelFile_rsClose<
this: JObject<'local>,
) {
throw_if_err(env, (), |env| {
env.take_rust_field::<_, _, Arc<VoiceModelFile>>(&this, "handle")?
env.take_rust_field::<_, _, VoiceModelFile>(&this, "handle")?
.close();
Ok(())
})
Expand Down

0 comments on commit 80c707b

Please sign in to comment.