forked from wasmerio/wasmer-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(InstanceContext): Avoid passing illegal pointers across CGo FFI …
…for user data Previously an unsafe.Pointer to user data was passed across the CGo FFI which resulted in a panic if the user data included any other Go pointers. This commit adds a global ctxData registry assigns a unique int id to each instance that calls SetContextData. This id is stored in the actual instance context data that crosses the CGo FFI and is used to look up the actual user data. A sync.RWMutex is used to synchronize access to the ctxData map. BREAKING CHANGE: This changes the API for Instance.SetContextData and InstanceContext.Data to accept and return an interface{} instead of an unsafe.Pointer. re wasmerio#44
- Loading branch information
Showing
2 changed files
with
49 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters