Skip to content

Conversation

@muenchow
Copy link

@muenchow muenchow commented Sep 24, 2025

What?

Currently, a #[externref] function that returns a Resource<..> will always return null.
The issue lies in Resource::take_raw: it drops the resource (and frees the slot) before get_externref is called.

This means that by the time get_externref tries to retrieve the ExternRef, the underlying resource has already been dropped.

Fix

The fix is to delay dropping the Resource<..> until the end of the function.
This ensures that get_externref can lookup the ExternRef before the slot is emptied.

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.

1 participant