Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client::new() panics when JACK is not installed #176

Closed
robbert-vdh opened this issue Jul 13, 2022 · 3 comments · Fixed by #177
Closed

Client::new() panics when JACK is not installed #176

robbert-vdh opened this issue Jul 13, 2022 · 3 comments · Fixed by #177

Comments

@robbert-vdh
Copy link
Member

I'd expect this to return an error if JACK is not available, but right now it just panics on an unwrap.

When creating a client, the library immediately calls jack_set_error_function:

pub fn new(client_name: &str, options: ClientOptions) -> Result<(Self, ClientStatus), Error> {
let _m = CREATE_OR_DESTROY_CLIENT_MUTEX.lock().unwrap();
unsafe {
jack_sys::jack_set_error_function(Some(error_handler));
jack_sys::jack_set_info_function(Some(info_handler));
}

And those functions call jack_sys::library().unwrap():

writeln!(out, " let library = crate::library().unwrap();").unwrap();

So if the library is not available or cannot be loaded, creating a client will panic instead of returning an error.

@Be-ing
Copy link
Contributor

Be-ing commented Jul 13, 2022

This is a regression from #172, which IMO should be reverted.

robbert-vdh added a commit to robbert-vdh/rust-jack that referenced this issue Jul 13, 2022
Before this trying to initialize a client when JACK was not avaiable
would result in an unrecoverable panic because of an unwrap on
`jack_sys::library()`.

Fixes RustAudio#176
robbert-vdh added a commit to robbert-vdh/rust-jack that referenced this issue Jul 13, 2022
Before this trying to initialize a client when JACK was not avaiable
would result in an unrecoverable panic because of an unwrap on
`jack_sys::library()`.

Fixes RustAudio#176
robbert-vdh added a commit to robbert-vdh/rust-jack that referenced this issue Jul 13, 2022
Before this trying to initialize a client when JACK was not available
would result in an unrecoverable panic because of an unwrap on
`jack_sys::library()`.

Fixes RustAudio#176
@Be-ing
Copy link
Contributor

Be-ing commented Jul 13, 2022

I think you can fix this by using version 0.9.2.

robbert-vdh added a commit to robbert-vdh/rust-jack that referenced this issue Jul 13, 2022
Before this trying to initialize a client when JACK was not available
would result in an unrecoverable panic because of an unwrap on
`jack_sys::library()`.

Fixes RustAudio#176
@robbert-vdh
Copy link
Member Author

I fixed this with #177.

robbert-vdh added a commit to robbert-vdh/rust-jack that referenced this issue Oct 31, 2022
Before this trying to initialize a client when JACK was not available
would result in an unrecoverable panic because of an unwrap on
`jack_sys::library()`.

Fixes RustAudio#176
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants