RustAudio / baseview

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

defer certain events on macOS to avoid re-entrant calls #189

Open httnn opened 6 months ago

httnn commented 6 months ago

previously, calling window.focus() would cause a crash in some scenarios, because certain members of WindowState were borrowed mutably while already being borrowed. this PR fixes the issue by deferring window focus events to be triggered before calling WindowHandler:on_frame().

dathinaios commented 6 months ago

I don't have a macOS machine to test this on however, and I'm not very familiar with macOS's APIs in general yet, so I think another pair of eyes would be good to double check this. 🙂

Tested on MacOS Ventura using Reaper, and it is working great 🙂👍

dathinaios commented 2 weeks ago

Any reason this is not being merged? I have been using these changes since May with no issues.