Be clear that you're supposed to make new nodes on every tree update #622
TheZipCreator
started this conversation in
General
Replies: 1 comment
-
From /**
* Appends the provided node to the tree update's list of nodes.
* Takes ownership of `node`.
*/
void accesskit_tree_update_push_node(struct accesskit_tree_update *update,
accesskit_node_id id,
struct accesskit_node *node); I thought this was clear enough that you'd have to create a new instance after calling this function. Any suggestions for improvements is welcome. This notice is not present on |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm currently creating a UI library in C, and I've started implementing accesskit in it. What I failed to realize was that you're supposed to create new
accesskit_node
s every single time you send a tree update, as opposed to keeping an instance in each UI component and mutating it when necessary (while also putting the IDs of mutated nodes in theaccesskit_tree_update
).It took me forever to realize that you're supposed to make new ones for every updated node. When you do keep nodes pointers around, it causes weird memory errors (double frees, segmentation faults) and it's hard to know what's going on. For a while, I thought the library was just broken. It would be nice if in the documentation this was mentioned somewhere.
Beta Was this translation helpful? Give feedback.
All reactions