macos_fixes #49
macos_fixes into main
With these changes, building the nih_plug_gain_iced example fails at compile time.
Compiling nih_plug v0.0.0 (https://github.com/BillyDM/nih-plug.git?rev=00eea25dd21b1f0ee18394252f6f2da6eb78b4ac#00eea25d)
error[E0425]: cannot find type `Profile` in this scope
--> /Users/exa/.cargo/git/checkouts/nih-plug-91edcc6c4ce5ef15/00eea25/src/wrapper/standalone/config.rs:102:21
|
102 | pub gl_profile: Profile,
| ^^^^^^^ not found in this scope
Ok, try it now!
Standalone, VST3 and CLAP work as expected, but closing the standalone version seems to still lead to a null pointer dereference. Causes this error message to pop up after closing.
The error / backtrace looks like this:
14:51:17 [ERROR] nih_plug::wrapper::util: thread 'main' panicked at 'null pointer dereference occurred': /Users/exa/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cocoa-0.24.1/src/appkit.rs:1782
0: backtrace::backtrace::libunwind::trace
at /Users/exa/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/backtrace-0.3.76/src/backtrace/libunwind.rs:117:9
backtrace::backtrace::trace_unsynchronized
at /Users/exa/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/backtrace-0.3.76/src/backtrace/mod.rs:66:14
backtrace::backtrace::trace
at /Users/exa/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/backtrace-0.3.76/src/backtrace/mod.rs:53:14
1: backtrace::capture::Backtrace::create
at /Users/exa/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/backtrace-0.3.76/src/capture.rs:294:9
2: backtrace::capture::Backtrace::new
at /Users/exa/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/backtrace-0.3.76/src/capture.rs:259:22
3: nih_plug::wrapper::util::log_panics::{{closure}}::{{closure}}
at /Volumes/Voidstar/Code/nih-plug/src/wrapper/util.rs:148:29
assert_no_alloc::permit_alloc
at /Users/exa/.cargo/git/checkouts/rust-assert-no-alloc-326423a65fd2fe4b/a6fb4f6/src/lib.rs:113:12
4: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/alloc/src/boxed.rs:2220:9
std::panicking::panic_with_hook
at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/std/src/panicking.rs:833:13
5: std::panicking::panic_handler::{{closure}}
at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/std/src/panicking.rs:691:13
6: std::sys::backtrace::__rust_end_short_backtrace
at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/std/src/sys/backtrace.rs:176:18
7: __rustc::rust_begin_unwind
at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/std/src/panicking.rs:689:5
8: core::panicking::panic_nounwind_fmt::runtime
at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/core/src/panicking.rs:122:22
core::panicking::panic_nounwind_fmt
at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/core/src/intrinsics/mod.rs:2449:9
9: core::panicking::panic_null_pointer_dereference
at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/core/src/panicking.rs:302:5
10: <*mut objc::runtime::Object as cocoa::appkit::NSWindow>::close
at /Users/exa/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cocoa-0.24.1/src/appkit.rs:1782:9
11: baseview::macos::window::WindowInner::close
at /Volumes/Voidstar/Code/baseview/src/macos/window.rs:94:31
12: iced_baseview::shell::window::WindowHandle<Message>::close_window
at /Volumes/Voidstar/Code/iced_baseview/src/shell/window.rs:238:24
<iced_baseview::shell::window::WindowHandle<Message> as core::ops::drop::Drop>::drop
at /Volumes/Voidstar/Code/iced_baseview/src/shell/window.rs:250:14
core::ptr::drop_in_place<iced_baseview::shell::window::WindowHandle<nih_plug_gain_iced::Message>>
at /Users/exa/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:805:1
13: core::ptr::drop_in_place<alloc::boxed::Box<dyn core::any::Any>>
at /Users/exa/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:805:1
core::ptr::drop_in_place<nih_plug::wrapper::standalone::wrapper::WrapperWindowHandler>
at /Users/exa/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:805:1
14: core::ptr::drop_in_place<alloc::boxed::Box<dyn baseview::window::WindowHandler>>
at /Users/exa/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:805:1
core::ptr::drop_in_place<core::cell::UnsafeCell<alloc::boxed::Box<dyn baseview::window::WindowHandler>>>
at /Users/exa/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:805:1
core::ptr::drop_in_place<core::cell::RefCell<alloc::boxed::Box<dyn baseview::window::WindowHandler>>>
at /Users/exa/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:805:1
core::ptr::drop_in_place<baseview::macos::window::WindowState>
at /Users/exa/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:805:1
15: alloc::rc::Rc<T,A>::drop_slow
at /Users/exa/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/rc.rs:396:13
16: <alloc::rc::Rc<T,A> as core::ops::drop::Drop>::drop
at /Users/exa/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/rc.rs:2472:22
core::ptr::drop_in_place<alloc::rc::Rc<baseview::macos::window::WindowState>>
at /Users/exa/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:805:1
baseview::macos::view::window_should_close
at /Volumes/Voidstar/Code/baseview/src/macos/view.rs:288:1
17: <unknown>
18: <unknown>
19: <unknown>
20: <unknown>
21: <unknown>
22: <unknown>
23: <unknown>
24: <unknown>
25: <unknown>
26: <unknown>
27: <unknown>
28: <unknown>
29: <unknown>
30: <unknown>
31: <unknown>
32: <unknown>
33: <unknown>
34: baseview::macos::window::Window::open_blocking
at /Volumes/Voidstar/Code/baseview/src/macos/window.rs:259:17
35: baseview::window::Window::open_blocking
at /Volumes/Voidstar/Code/baseview/src/window.rs:87:9
nih_plug::wrapper::standalone::wrapper::Wrapper<P,B>::run
at /Volumes/Voidstar/Code/nih-plug/src/wrapper/standalone/wrapper.rs:337:17
36: nih_plug::wrapper::standalone::run_wrapper
at /Volumes/Voidstar/Code/nih-plug/src/wrapper/standalone.rs:188:19
nih_plug::wrapper::standalone::nih_export_standalone_with_args::{{closure}}
at /Volumes/Voidstar/Code/nih-plug/src/wrapper/standalone.rs:132:17
core::result::Result<T,E>::unwrap_or_else
at /Users/exa/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/result.rs:1622:23
nih_plug::wrapper::standalone::nih_export_standalone_with_args
at /Volumes/Voidstar/Code/nih-plug/src/wrapper/standalone.rs:130:20
nih_plug::wrapper::standalone::nih_export_standalone
at /Volumes/Voidstar/Code/nih-plug/src/wrapper/standalone.rs:53:5
37: core::ops::function::FnOnce::call_once
at /Users/exa/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
std::sys::backtrace::__rust_begin_short_backtrace
at /Users/exa/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs:160:18
38: std::rt::lang_start::{{closure}}
39: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/core/src/ops/function.rs:287:21
std::panicking::catch_unwind::do_call
at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/std/src/panicking.rs:581:40
std::panicking::catch_unwind
at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/std/src/panicking.rs:544:19
std::panic::catch_unwind
at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/std/src/panic.rs:359:14
std::rt::lang_start_internal::{{closure}}
at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/std/src/rt.rs:175:24
std::panicking::catch_unwind::do_call
at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/std/src/panicking.rs:581:40
std::panicking::catch_unwind
at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/std/src/panicking.rs:544:19
std::panic::catch_unwind
at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/std/src/panic.rs:359:14
std::rt::lang_start_internal
at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library/std/src/rt.rs:171:5
40: _main
The culprit seems to be that baseview's WindowInner::close is called twice.
The function closes the ns_window. The second time around, this is a null pointer, hence the crash.
// Close the window if in non-parented mode
ifletSome(ns_window)=self.ns_window.take(){ns_window.close();}This function is called twice because macOS evokes it for clicking the close button, and iced_baseview calls it when the WindowHandle is dropped (iced_baseview::shell::window::WindowHandle::drop)
This project has moved to a new hard fork of NIH-plug for easier maintanence: https://codeberg.org/BillyDM/nih-plug
- Cargo.toml
- examples/nih_plug_gain_iced/src/lib.rs
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?