Skip to content

Commit

Permalink
musikr: dont pass JObject ownership
Browse files Browse the repository at this point in the history
90% sure this causes the JObject to be dropped incorrectly.
  • Loading branch information
OxygenCobalt committed Feb 19, 2025
1 parent 894e265 commit 4760472
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions musikr/src/main/jni/src/jstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use std::io::SeekFrom;

pub struct JInputStream<'local> {
env: SharedEnv<'local>,
input: JObject<'local>,
input: &'local JObject<'local>,
}

impl<'local, 'a> JInputStream<'local> {
pub fn new(env: SharedEnv<'local>, input: JObject<'local>) -> Self {
pub fn new(env: SharedEnv<'local>, input: &'local JObject<'local>) -> Self {
Self { env, input }
}
}
Expand Down
2 changes: 1 addition & 1 deletion musikr/src/main/jni/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub extern "C" fn Java_org_oxycblt_musikr_metadata_MetadataJNI_openFile<'local>(
) -> jobject {
// Create JInputStream from the Java input stream
let shared_env = Rc::new(RefCell::new(env));
let stream = JInputStream::new(shared_env.clone(), input);
let stream = JInputStream::new(shared_env.clone(), &input);
let file_ref = FileRef::new(stream);
let file = file_ref.file();
let mut jbuilder = JMetadataBuilder::new(shared_env.clone());
Expand Down

0 comments on commit 4760472

Please sign in to comment.