musikr: dont pass JObject ownership

90% sure this causes the JObject to be dropped incorrectly.
This commit is contained in:
Alexander Capehart 2025-02-19 16:04:33 -07:00
parent 894e265a2c
commit 47604724a4
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
2 changed files with 3 additions and 3 deletions

View file

@ -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 }
}
}

View file

@ -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());