-
Notifications
You must be signed in to change notification settings - Fork 920
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
Initial transition to objc2
#2452
Conversation
Cargo.toml
Outdated
# Branch: objc2 | ||
cocoa = { git = "https://github.com/madsmtm/core-foundation-rs.git", rev = "8e6c4854de2408ed1e3e614dbe6f9f2762bde7c3" } | ||
core-foundation = { git = "https://github.com/madsmtm/core-foundation-rs.git", rev = "8e6c4854de2408ed1e3e614dbe6f9f2762bde7c3" } | ||
core-graphics = { git = "https://github.com/madsmtm/core-foundation-rs.git", rev = "8e6c4854de2408ed1e3e614dbe6f9f2762bde7c3" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only in the interim; once #2427 is fully merged, the need for this will be gone
CHANGELOG.md
Outdated
@@ -8,6 +8,8 @@ And please only add new entries to the top of this list, right below the `# Unre | |||
|
|||
# Unreleased | |||
|
|||
- **Breaking:** Bump MSRV from `1.57` to `1.60`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that objc2
doesn't have a MSRV policy yet, see madsmtm/objc2#203.
But since we use a pinned dependency, this shouldn't be a problem (yet).
806722f
to
4a7e9d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have that much to say, given that I have no clue about the objc
internals. The changes look good, some minor notes.
@@ -175,8 +167,8 @@ impl fmt::Debug for MonitorHandle { | |||
|
|||
impl MonitorHandle { | |||
pub fn retained_new(uiscreen: id) -> MonitorHandle { | |||
assert_main_thread!("`MonitorHandle` can only be cloned on the main thread on iOS"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has nothing to do with that PR, but could libdispatch
used to drop
from the main thread? So we won't have runtime panics like that? Though I think the issue that you can't use that from the other thread as well?
It just all looks wrong to me. We say that winit window is Send
and you can get MonitorHandle
from the Window
(owning one iirc), but when you drop it you'll panic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is so much thread-unsafety in our macOS (and probably also iOS, but less well-versed in that) implementation, really, you have no idea!
Anyway, to answer your question: Yes, we could and should use libdispatch
to do things on the main thread, both here and in a lot of other places. I'm in the process of exploring solutions, have focused on objc2
stuff first though.
58f3022
to
34fb9ad
Compare
34fb9ad
to
f41d459
Compare
Move to
objc2
, my fork ofobjc
which adds a lot of things, in particular macros for proper memory management, and a lot of fixed soundness issues.Split out from of #2427.
Concrete improvements in
objc2
which can be seen in this PR:msg_send!
can now returnbool
without special handling.msg_send!
are now required to beEncode
. This helped catching a lot of undefined behaviour, which are fixed in Fix some invalidmsg_send!
usage #2138 and iOS: Fix a few instances of UB #2428.Checklist:
CHANGELOG.md
if knowledge of this change could be valuable to users