arcnmx / wireplumber.rs

wireplumber rust bindings
https://arcnmx.github.io/wireplumber.rs/main/wireplumber/
MIT License
21 stars 3 forks source link

`wireplumber::pw::Link::state()` panics when error is `null` #6

Closed tom-a-wagner closed 1 year ago

tom-a-wagner commented 1 year ago

wireplumber::pw::Link::state() panics for me when the returned error is null:

thread 'main' panicked at 'assertion failed: !ptr.is_null()', /var/home/tomwagner/Projects/pipewire/helvum/debug/cargo-home/registry/src/github.com-1ecc6299db9ec823/glib-0.16.2/src/gstring.rs:787:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/panicking.rs:142:14
   2: core::panicking::panic
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/panicking.rs:48:5
   3: <glib::gstring::GString as glib::translate::FromGlibPtrNone<*const u8>>::from_glib_none
             at ./cargo-home/registry/src/github.com-1ecc6299db9ec823/glib-0.16.2/src/gstring.rs:787:9
   4: glib::translate::from_glib_none
             at ./cargo-home/registry/src/github.com-1ecc6299db9ec823/glib-0.16.2/src/translate.rs:1459:5
   5: <glib::gstring::GString as glib::translate::FromGlibPtrNone<*const i8>>::from_glib_none
             at ./cargo-home/registry/src/github.com-1ecc6299db9ec823/glib-0.16.2/src/gstring.rs:798:9
   6: glib::translate::from_glib_none
             at ./cargo-home/registry/src/github.com-1ecc6299db9ec823/glib-0.16.2/src/translate.rs:1459:5
   7: wireplumber::auto::link::Link::state
             at ./cargo-home/git/checkouts/wireplumber.rs-cb0425781db64edb/73bc32e/src/auto/link.rs:73:19
...

The out parameter for the error is marked as optional but it seems the bindings assume it is not.

tom-a-wagner commented 1 year ago

Just in case anyone is looking for a workaround, using link.property::<wp::pw::LinkState>("state") works fine.