Replies: 1 comment
-
Seems like a reasonable idea, but not sure the best way to make this happen. You could send PRs, but all platform code changes carry a relatively high risk because of the lack of automated testability, and the comparative ease of creating dead-locks in rust, or crashes in macOS; so it's hard for us to prioritize them unless they're fixing known other problems. One thing to watch out for is re-entrancy. If you call a macOS function that can call an application delegate method then you must make sure to drop the lock first. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been looking at
crates/gpui/src/platform/mac/platform.rs
and I noticed a pattern with how theMacPlatformState
is mutated.MacPlatform
which is a wrapper aroundMacPlatformState
with a Mutex.All unsafe functions are implemented for
MacPlatform
and usage usually looks something like this (simplified example):If instead we implemented methods that interact with the state for the
MacPlatformState
instead ofMacPlatform
. We could change the signature for the methods from taking&self
to&mut self
. This is always the case anyway, since the state is behind a mutex, and we wouldn't need to redundantly pass elements from state to a method thats implemented on itself. Our api would turn into something like this:If the zed team is interested in a change like this, I'd be willing to work on a PR.
Beta Was this translation helpful? Give feedback.
All reactions