Skip to content

Functions to safely read from Ptr fields #50

@cjay

Description

@cjay

I managed to shoot myself in the foot by reading back an array that was set via setListCountAndRef by extracting the Ptr near the end of the lifetime of a struct, followed by reading the array with peekArray. Because the array lifetime is coupled to the struct lifetime, this caused the array to be overwritten sometimes before peekArray was finished.
While that's entirely my fault, it would be nice to have more field accessor functions. I already have some in Program.Foreign: withUnsafeField, getListCountAndRef. (Besides, the function withArrayLen from this module should probably be in Graphics.Vulkan.Marshal). Not making a pull request because I don't know where to put them, and I guess they can be done without IO somehow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions