Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

httnn
Copy link
Contributor

@httnn httnn commented May 10, 2024

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().

Copy link
Member

@prokopyl prokopyl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from a little nitpick this looks good to me. 👍

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. 🙂

src/macos/window.rs Outdated Show resolved Hide resolved
src/macos/window.rs Show resolved Hide resolved
@dathinaios
Copy link
Contributor

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 🙂👍

src/macos/window.rs Outdated Show resolved Hide resolved
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.

4 participants