Replies: 2 comments 1 reply
-
doesn't it already exist?
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Closing this thanks to @iAndyHD3 pointing out what I completely missed. |
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
-
At the moment there are methods in
Node
that support attaching custom data to a node, being:The problem with this is one of memory management. If a pointer to an object is set as the custom user data, then there is no way to know if that object needs to be freed, since there is no indicator of object ownership.
What I propose is that new methods are added, which allow ownership and object lifetime to be clearly defined. The existing
void*
implementations should remain in case they are being used in existing projects.For example, we can add objects that are of type
ax::Ref*
, so that they can be reference counted, and if that object is no longer required, then it automatically frees itself. Something along the lines of:Another option would be using smart pointers:
Would any of the above suggestions be useful?
Beta Was this translation helpful? Give feedback.
All reactions