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

delegates: allocate VTable in heap #95

Merged
merged 1 commit into from
May 9, 2024

Conversation

jagobagascon
Copy link
Contributor

The VTable is a field all WinRT types have and it is used to store pointers to all the class functions. This field is usually created by WinRT, but for delegates we need to provide our own VTable instance.

We were previously using a Go struct pointer as our VTable, but Go structs can be randomly moved or GCed by the Go runtime, and since we are pasing the VTable to WinRT (out of the Go runtime), we were getting random invalid memory errors.

This was addressed in a previous PR (#64) but somehow we missed this.

fixes #94

The VTable is a field all WinRT types have and it is used to store
pointers to all the class functions. This field is usually created by
WinRT, but for delegates we need to provide our own VTable instance.

We were previously using a Go struct pointer as our VTable, but Go
structs can be randomly moved or GCed by the Go runtime, and since we
are pasing the VTable to WinRT (out of the Go runtime), we were getting
random invalid memory errors.

This was addressed in a previous PR (#64) but somehow we missed this.

fixes #94
@jagobagascon jagobagascon force-pushed the feature/alloc-vtable-in-the-heap branch from d40e892 to 3fb5e41 Compare May 9, 2024 10:22
@jagobagascon jagobagascon merged commit 4f7860a into main May 9, 2024
2 checks passed
@jagobagascon jagobagascon deleted the feature/alloc-vtable-in-the-heap branch May 9, 2024 16:41
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.

Help: program exits abnormally with exit status 0xc0000005
2 participants