Skip to content

Update Iced to 0.13#170

Open
alec-mccormick wants to merge 15 commits intorobbert-vdh:masterfrom
alec-mccormick:iced-0.13
Open

Update Iced to 0.13#170
alec-mccormick wants to merge 15 commits intorobbert-vdh:masterfrom
alec-mccormick:iced-0.13

Conversation

@alec-mccormick
Copy link
Copy Markdown

Piggybacking off of @ilya-epifanov's PR, this updates the versions of iced_baseview and iced to 0.13.

GenericUI, ParamSlider, and PeakMeter widgets are all ported and working. The text input for ParamSlider behaves slightly buggy but it is otherwise functional.

I have tested and verified the gain_gui_iced example plugin on Mac as a VST3 in Ableton.

@padenot
Copy link
Copy Markdown

padenot commented Jun 30, 2025

I tried this PR on an M1 Max w/ Sequoia 15.5, and I have a crash during GUI initialization (e.g. first editor open) (tested both recent REAPER and latest Ableton Live):

Details
    frame #0: 0x0000000190789388 libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x00000001907c288c libsystem_pthread.dylib`pthread_kill + 296
    frame #2: 0x00000001906cbc60 libsystem_c.dylib`abort + 124
    frame #3: 0x0000000173eec754 gain_gui_iced`std::sys::pal::unix::abort_internal::h21ffa6232271560a at mod.rs:366:14 [opt]
    frame #4: 0x0000000173ec0654 gain_gui_iced`std::panicking::rust_panic_with_hook::h1882a30575fbb763 at panicking.rs:0 [opt]
    frame #5: 0x0000000173ec01bc gain_gui_iced`std::panicking::begin_panic_handler::_$u7b$$u7b$closure$u7d$$u7d$::h39275ef3005e6337 at panicking.rs:699:13 [opt]
  * frame #6: 0x0000000173ebf278 gain_gui_iced`std::sys::backtrace::__rust_end_short_backtrace::h6ede323c05a76849 at backtrace.rs:168:18 [opt]
    frame #7: 0x0000000173ebfe8c gain_gui_iced`__rustc::rust_begin_unwind at panicking.rs:697:5 [opt]
    frame #8: 0x0000000173eecefc gain_gui_iced`core::panicking::panic_nounwind_fmt::hae736249e48cf020 [inlined] core::panicking::panic_nounwind_fmt::runtime::hcbc23776d9f6f115 at panicking.rs:117:22 [opt]
    frame #9: 0x0000000173eecee8 gain_gui_iced`core::panicking::panic_nounwind_fmt::hae736249e48cf020 at mod.rs:3241:9 [opt]
    frame #10: 0x0000000173eed0b8 gain_gui_iced`core::panicking::panic_null_pointer_dereference::h876d13db2aeb73ef at panicking.rs:304:5 [opt]
    frame #11: 0x0000000173d53eec gain_gui_iced`baseview::macos::view::become_first_responder::h516b12e02cd0415a(this=0x000000011be58f50, _sel=Sel @ 0x000000016fdf0468) at view.rs:248:35
    frame #12: 0x00000001948bfccc AppKit`-[NSWindow _realMakeFirstResponder:] + 556
    frame #13: 0x0000000173d4d5a4 gain_gui_iced`_$LT$$LP$A$C$$RP$$u20$as$u20$objc..message..MessageArguments$GT$::invoke::h74289d4bbb1ea84f(imp=(libobjc.A.dylib`objc_msgSend), obj=0x000000011be359f0, sel=Sel @ 0x000000016fdf0788, (null)=(&objc::runtime::Object) @ 0x000000016fdf07a8) at mod.rs:128:17
    frame #14: 0x0000000173d4c774 gain_gui_iced`objc::message::platform::send_unverified::hab0fa43f5e4ee398(obj=0x000000011be359f0, sel=Sel @ 0x000000016fdf0808, args=(&objc::runtime::Object) @ 0x000000016fdf0828) at mod.rs:27:9
    frame #15: 0x0000000173d55c9c gain_gui_iced`baseview::macos::view::view_will_move_to_window::hf447211240bcea71 [inlined] objc::message::send_message::h7ace45af2218c919(obj=0x000000011be359f0, sel=Sel @ 0x000000016fdf0f58, args=(&objc::runtime::Object) @ 0x000000016fdf0f70) at mod.rs:178:5
    frame #16: 0x0000000173d55c80 gain_gui_iced`baseview::macos::view::view_will_move_to_window::hf447211240bcea71(this=0x000000011be58f50, _self=Sel @ 0x000000016fdf0a80, new_window=0x000000011be359f0) at view.rs:371:25
    frame #17: 0x00000001947e7f58 AppKit`-[NSView _setWindow:] + 332
    frame #18: 0x00000001947ef18c AppKit`-[NSView addSubview:] + 220
    frame #19: 0x0000000173d5ea5c gain_gui_iced`_$LT$$LP$A$C$$RP$$u20$as$u20$objc..message..MessageArguments$GT$::invoke::h0ebe41ec9b755973(imp=(libobjc.A.dylib`objc_msgSend), obj=0x000000015a74f800, sel=Sel @ 0x000000016fdf15b8, (null)=(*mut objc::runtime::Object) @ 0x000000016fdf15d8) at mod.rs:128:17
    frame #20: 0x0000000173d5f7e4 gain_gui_iced`objc::message::platform::send_unverified::h8755527458b69572(obj=0x000000015a74f800, sel=Sel @ 0x000000016fdf1638, args=(*mut objc::runtime::Object) @ 0x000000016fdf1658) at mod.rs:27:9
    frame #21: 0x0000000173c1a74c gain_gui_iced`baseview::macos::window::Window::open_parented::he2fece6eea86908b [inlined] objc::message::send_message::h7c02a57bd7c61243(obj=0x000000015a74f800, sel=Sel @ 0x000000016fdf1a30, args=(*mut objc::runtime::Object) @ 0x000000016fdf1a48) at mod.rs:178:5
    frame #22: 0x0000000173c1a730 gain_gui_iced`baseview::macos::window::Window::open_parented::he2fece6eea86908b(parent=0x000000016fdf2140, options=WindowOpenOptions @ 0x000000016fdf1bb8, build={closure_env#0}, nih_plug::editor::ParentWindowHandle, ()> @ 0x000000016fdf1bf0) at window.rs:169:25
    frame #23: 0x0000000173c2d820 gain_gui_iced`baseview::window::Window::open_parented::h38f0ff29875acc63(parent=0x000000016fdf2140, options=, build=) at window.rs:77:29
    frame #24: 0x0000000173bcf75c gain_gui_iced`iced_baseview::window::IcedWindow$LT$A$GT$::open_parented::h62fc7a1cc4db9993(parent=0x000000016fdf2140, flags=(alloc::sync::Arc, alloc::sync::Arc, alloc::alloc::Global>, (alloc::sync::Arc, alloc::sync::Arc)) @ 0x000000016fdf1de8, settings=Settings @ 0x000000016fdf1e28) at window.rs:95:25
    frame #25: 0x0000000173c446d8 gain_gui_iced`iced_baseview::open_parented::h384e784904d0c63d(parent=0x000000016fdf2140, flags=, settings=) at lib.rs:169:5
    frame #26: 0x0000000173c5cc38 gain_gui_iced`_$LT$nih_plug_iced..editor..IcedEditorWrapper$LT$E$GT$$u20$as$u20$nih_plug..editor..Editor$GT$::spawn::hc304adacdb8df909(self=0x00006000038a0870, parent=ParentWindowHandle @ 0x000000016fdf2140, context=Arc @ 0x000000016fdf1dc8) at editor.rs:41:22
    frame #27: 0x0000000173bfd7c8 gain_gui_iced`_$LT$nih_plug..wrapper..vst3..view..WrapperView$LT$P$GT$$u20$as$u20$vst3_sys..gui..iplugview..IPlugView$GT$::attached::h2b21ce20824e104c(self=0x0000600003d7c000, parent=0x000000015a74f800, type_="NSView") at view.rs:303:17
    frame #28: 0x0000000173ca4420 gain_gui_iced`_$LT$dyn$u20$vst3_sys..gui..iplugview..IPlugView$u20$as$u20$vst3_com..ProductionComInterface$LT$C$GT$$GT$::vtable::iplugview_attached::h398b746003e3ccfb(arg0=0x0000600003d7c000, arg1=0x000000015a74f800, arg2="NSView") at iplugview.rs:15:1
    frame #29: 0x0000000100553630 REAPER`VST_HostedPlugin::VST3_Dispatcher(AEffect*, int, int, long long, void*, float) + 3772
    frame #30: 0x0000000100385cfc REAPER`VST_HostedPlugin::ShowConfig(HWND__*, RECT const*) + 1116
    frame #31: 0x000000010039e7b0 REAPER`FxDsp::showConfigInternal(HWND__*, RECT const*, int) + 964
    frame #32: 0x000000010039e07c REAPER`FxDsp::showConfig(HWND__*, RECT*, int) + 816
    frame #33: 0x00000001003ba814 REAPER`FxChain::displayDspConfig(HWND__*, int) + 272
    frame #34: 0x00000001003c66ac REAPER`FxChain::onDspAdded(HWND__*, int, char const*, int, bool) + 688
    frame #35: 0x00000001003e4cd0 REAPER`fxadd_add_recs_to_chain(FxAddDef**, int, FxChain*, int, int, int, bool, bool) + 1236
    frame #36: 0x00000001003f44f4 REAPER`add_to_chain(HWND__*, FxChain*, int, int, int, bool, int, bool) + 496
    frame #37: 0x00000001003f3d24 REAPER`do_insert(HWND__*, bool) + 232
    frame #38: 0x00000001003e8c94 REAPER`addDialogProc(HWND__*, unsigned int, unsigned long, long) + 15324
    frame #39: 0x00000001004fd794 REAPER`SwellDialogDefaultWindowProc(HWND__*, unsigned int, unsigned long, long) + 444
    frame #40: 0x00000001003ea020 REAPER`addDialogProc(HWND__*, unsigned int, unsigned long, long) + 20328
    frame #41: 0x00000001004fd794 REAPER`SwellDialogDefaultWindowProc(HWND__*, unsigned int, unsigned long, long) + 444
    frame #42: 0x00000001004fbb40 REAPER`-[REAPERSwell_hwnd swellOnControlDoubleClick:] + 320
    frame #43: 0x0000000194973020 AppKit`-[NSApplication(NSResponder) sendAction:to:from:] + 560
    frame #44: 0x0000000194972dc0 AppKit`-[NSControl sendAction:to:] + 72
    frame #45: 0x0000000194a71dac AppKit`-[NSTableView _sendAction:to:row:column:] + 112
    frame #46: 0x0000000194a70620 AppKit`-[NSTableView mouseDown:] + 4040
    frame #47: 0x000000010051889c REAPER`-[REAPERSwell_listview mouseUp:] + 244
    frame #48: 0x00000001953980b8 AppKit`_routeMouseUpEvent + 132
    frame #49: 0x00000001948f9c90 AppKit`-[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 440
    frame #50: 0x00000001948f9910 AppKit`-[NSWindow(NSEventRouting) sendEvent:] + 288
    frame #51: 0x0000000195171330 AppKit`-[NSApplication(NSEventRouting) sendEvent:] + 1504
    frame #52: 0x000000010034e328 REAPER`-[REAPERapp sendEvent:] + 3184
    frame #53: 0x0000000194d7042c AppKit`-[NSApplication _handleEvent:] + 60
    frame #54: 0x00000001947c6c8c AppKit`-[NSApplication run] + 520
    frame #55: 0x000000019479d35c AppKit`NSApplicationMain + 880
    frame #56: 0x0000000190422b98 dyld`start + 6076

some excerpts from lldb while I'll continue debugging:

frame #11: 0x0000000173d53eec gain_gui_iced`baseview::macos::view::become_first_responder::h516b12e02cd0415a(this=0x000000011be58f50, _sel=Sel @ 0x000000016fdf0468) at view.rs:248:35
   245 	    let state = unsafe { WindowState::from_view(this) };
   246 	    let is_key_window = unsafe {
   247 	        let window: id = msg_send![this, window];
-> 248 	        let is_key_window: BOOL = msg_send![window, isKeyWindow];
   249 	        is_key_window == YES
   250 	    };
   251 	    if is_key_window {

window is nullptr here, this is about here: https://github.com/RustAudio/baseview/blob/master/src/macos/view.rs#L249, but I see just now that they've just added null check in the latest commit, I'll try it out, time permitting. Reading the issue, I'm indeed on a rustc > 1.86 (namely 1.87).

Finger's crossed we might just be able to bump the version.

@padenot
Copy link
Copy Markdown

padenot commented Jul 1, 2025

Ok, I got everything working, but it is a bit more involved than just bumping a few deps. Roughly:

  • Update baseview
  • Update baseview-iced to current iced main, to pick up recent wgpu and such
  • Update code in this crate + in baseview-iced
  • Update the example plugin

it isn't too much code though, most of the work was done in this PR already. With this, the Gain GUI plugin works. I've also added rotary pots (unipolar, bipolar, and one that is unipolar but grows both ways, that I like to use to implement stereo width controls).

I'll push the code in a few, although it is based on iced main branch, so ideally we'll wait until they cut a release. I've only tested macOS for now, but I have access to everything.

@fazibear
Copy link
Copy Markdown

fazibear commented Aug 4, 2025

Hi,

I'm using code from @alec-mccormick branch. It works only in --release.

But for some reasons images don't appears (svg works correctly).
There is empty place instead of image.
Path to image is correct.

Checked in standalone and vst3 on Mac OS.
Any idea why? Thanks for help.

nih_plug = { git = "https://github.com/alec-mccormick/nih-plug", branch = "iced-0.13", features = ["standalone"] }
nih_plug_iced = { git = "https://github.com/alec-mccormick/nih-plug", branch = "iced-0.13",  features = ["wgpu", "image", "canvas", "debug"] }

@padenot Where I can find your forks?

@padenot
Copy link
Copy Markdown

padenot commented Aug 6, 2025

@padenot Where I can find your forks?

padenot@7b78c6e, just pushed. It's been working well for me. It is based on the code of this PR, but for now it references dependencies by path (so that I could work on my plugin). I'm waiting for iced 0.14 to be released, then I'll finish BillyDM/iced_baseview#43, then clean up this nih-plug branch, then it should be good.

To set this up for working on a plugin, I've created a directory, and then put the following in it:
-baseview @ 3724a00c970a9cd10a3494fa3c37bca66d631bb7 (unmodified)
-iced_baseview, with the PR checked out, and referencing ourbaseview (modify Cargo.toml). Note that it references iced by path for now (to be changed on release, before merging)
-iced current main
-nih-plug with my branch checked out

Now you can build a plugin referencing this nih-plug by path and it should work.

@fazibear
Copy link
Copy Markdown

fazibear commented Aug 9, 2025

Bad news guys. These changes introducing a crash.

Testing the native gain_gui_iced app from @alec-mccormick branch.

  • run cargo run --release
  • wait 15 minutes
  • crash: thread 'main' has overflowed its stack

Same plugin from master branch works whole night without problem.

This is a system MacOS stack trace:

0   libsystem_kernel.dylib        	       0x19ef81388 __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x19efba88c pthread_kill + 296
2   libsystem_c.dylib             	       0x19eec3c60 abort + 124
3   myplugin      	            	         0x105219534 std::sys::pal::unix::abort_internal::h13d02a68e0365656 + 12
4   myplugin      	            	         0x1051c1588 std::sys::pal::unix::stack_overflow::imp::signal_handler::hd4d0a02b76e46890 + 156
5   libsystem_platform.dylib      	       0x19eff4624 _sigtramp + 56
6   myplugin      	            	         0x104b4fcd4 _$LT$nih_plug_iced..wrapper..IcedEditorWrapperApplication$LT$E$GT$$u20$as$u20$iced_baseview..application..Application$GT$::subscription::_$u7b$$u7b$closure$u7d$$u7d$::h3ca5012753e76d40 + 56
7   myplugin      	            	         0x104b4fd54 _$LT$nih_plug_iced..wrapper..IcedEditorWrapperApplication$LT$E$GT$$u20$as$u20$iced_baseview..application..Application$GT$::subscription::_$u7b$$u7b$closure$u7d$$u7d$::h3e09acfcdab62649 + 80
... lot of alsmost same lines ...

Looks like is somethings about subscription in wrapper.rs.

Will check if @padenot branch also crashes.

@fazibear
Copy link
Copy Markdown

fazibear commented Aug 9, 2025

@padenot
Copy link
Copy Markdown

padenot commented Aug 11, 2025

Ah yes, I think I have a fix for this locally, I must have failed to push it to my branch, I'll do it shortly, time permitting.

@padenot
Copy link
Copy Markdown

padenot commented Aug 11, 2025

Ah no, the fix is commenting it out, I remember the issue was that it called itself recursively, and I was in the middle of something so just commented it out.

I think we might want to avoid this recursion, aren't we ping-ponging between editor_window_subs's onframe handler and this function?

@fazibear
Copy link
Copy Markdown

This is my quick fix:

fazibear@920e286

Don't always return Some(..) and clone message value instead arc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants