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

Using async traint crashes at "Foreign pointer not set" #2343

Closed
crazytonyli opened this issue Dec 5, 2024 · 3 comments
Closed

Using async traint crashes at "Foreign pointer not set" #2343

crazytonyli opened this issue Dec 5, 2024 · 3 comments

Comments

@crazytonyli
Copy link
Contributor

I ran into a crash when having a crate using an async trait defined in another crate. Here is the crash site.

NonNull::new(self.0.load(Ordering::Relaxed))
.expect("Foreign pointer not set. This is likely a uniffi bug.")
.as_mut()

To reproduce this crash:

  1. Get the project from https://github.com/crazytonyli/uniffi-foreign-async-crash
  2. Run ./build.sh && swift test --package-path swift. You can see the full backtrace from Xcode, too.

I'm using Xcode 16.1 on macOS 15.

@mhammond
Copy link
Member

mhammond commented Dec 6, 2024

Thanks for the report. One of us will try and repro this, but if you'd like to help things along, the most impactful thing you could do would be to submit a patch which demonstrates it in our fixtures - this is the first thing anyone would need to do regardless so that any fix has suitable tests, and having this done beforehand would make it that much more tractable for one of us to look into the actual problem.

@crazytonyli
Copy link
Contributor Author

I can have a look at that if I find some time. Meanwhile, to whoever is looking at this issue, please feel free to use the code in the project if needed.

crazytonyli added a commit to crazytonyli/uniffi-rs that referenced this issue Dec 10, 2024
crazytonyli added a commit to crazytonyli/uniffi-rs that referenced this issue Dec 10, 2024
@bendk
Copy link
Contributor

bendk commented Dec 24, 2024

I believe #2367 fixes this one

bendk added a commit to bendk/uniffi-rs that referenced this issue Dec 27, 2024
@bendk bendk closed this as completed in 602b715 Dec 31, 2024
bendk added a commit that referenced this issue Dec 31, 2024
Initialize VTables for external types (#2343)
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

No branches or pull requests

3 participants