RustAudio / baseview

low-level window system interface for audio plugin UIs
Apache License 2.0
267 stars 57 forks source link

Linux: Panic when trying to receive raw window handle #111

Closed mitchpk closed 2 years ago

mitchpk commented 2 years ago

On Linux, I am building OctaSine as a VST2 plugin. When loading the plugin within REAPER, it panics and causes REAPER to crash. This is the backtrace gathered from the core dump:

#0  0x00007f86c9a51d22 in raise () at /usr/lib/libc.so.6
#1  0x00007f86c9a3b862 in abort () at /usr/lib/libc.so.6
#2  0x00007f868f14b127 in std::sys::unix::abort_internal () at library/std/src/sys/unix/mod.rs:259
#3  0x00007f868f146860 in std::panicking::rust_panic () at library/std/src/panicking.rs:656
#4  0x00007f868f14673b in std::panicking::rust_panic_with_hook () at library/std/src/panicking.rs:624
#5  0x00007f868f146150 in std::panicking::begin_panic_handler::{closure#0} () at library/std/src/panicking.rs:502
#6  0x00007f868f144764 in std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::{closure#0}, !> ()
    at library/std/src/sys_common/backtrace.rs:139
#7  0x00007f868f1460b9 in std::panicking::begin_panic_handler () at library/std/src/panicking.rs:498
#8  0x00007f868e54b661 in core::panicking::panic_fmt () at library/core/src/panicking.rs:107
#9  0x00007f868e54b753 in core::result::unwrap_failed () at library/core/src/result.rs:1613
#10 0x00007f868e6089bb in core::result::Result<core::result::Result<baseview::x11::window::SendableRwh, ()>, std::sync::mpsc::RecvError>::unwrap<core::result::Result<baseview::x11::window::SendableRwh, ()>, std::sync::mpsc::RecvError> (self=...)
    at /rustc/02072b482a8b5357f7fb5e5637444ae30e423c40/library/core/src/result.rs:1295
#11 0x00007f868e6409c8 in baseview::x11::window::Window::open_parented<octasine::gui::ParentWindow, iced_baseview::window::IcedWindow<octasine::gui::interface::OctaSineIcedApplication<alloc::sync::Arc<octasine::SyncState>>>, iced_baseview::window::{impl#4}::open_parented::{closure#0}> (parent=0x7ffe27e9e3e0, options=..., build=...)
    at baseview-9d6c750431f4479e/004065e/src/x11/window.rs:131
#12 0x00007f868e6359e1 in baseview::window::Window::open_parented<octasine::gui::ParentWindow, iced_baseview::window::IcedWindow<octasine::gui::interface::OctaSineIcedApplication<alloc::sync::Arc<octasine::SyncState>>>, iced_baseview::window::{impl#4}::open_parented::{closure#0}>
    (parent=0x7ffe27e9e3e0, options=..., build=...) at baseview-9d6c750431f4479e/004065e/src/window.rs:67
#13 0x00007f868e67cb42 in iced_baseview::window::IcedWindow<octasine::gui::interface::OctaSineIcedApplication<alloc::sync::Arc<octasine::SyncState>>>::open_parented<octasine::gui::interface::OctaSineIcedApplication<alloc::sync::Arc<octasine::SyncState>>, octasine::gui::ParentWindow>
    (parent=0x7ffe27e9e3e0, settings=...) at iced_baseview-7c672318e3bd7e89/b4d8edb/src/window.rs:355
#14 0x00007f868e652571 in octasine::gui::Gui<alloc::sync::Arc<octasine::SyncState>>::open_parented<alloc::sync::Arc<octasine::SyncState>>
    (parent=..., sync_handle=...) at octasine/src/gui/mod.rs:59
#15 0x00007f868e65276b in octasine::gui::{impl#1}::open<alloc::sync::Arc<octasine::SyncState>> (self=0x2420750, parent=0x6400757)
    at octasine/src/gui/mod.rs:87

Unusually, this only occurs when using the plugin within REAPER, whereas it works fine if I load the plugin with Carla. Additionally, I compiled OctaSine as a Windows DLL and tested that using yabridge in the same REAPER installation, which worked flawlessly.