You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ZSolarDev edited this page Nov 9, 2026
·
1 revision
You need to be VERY careful about this when using Hx4Diva: dereferencing and/or copying objects.
Due to the fact that haxe usually handles memory automatically, and due to the fact that there's no pointer system by default, I had to use the one from hxcpp. And it does work, but I've discovered that it's extremely easy to accidentally copy and/or dereference an object wrapped in Reference, Pointer, RawPointer, etc.
This really is all it takes:
// Let's say ctx.foo is of type cpp.Reference<Foo>.varfoo:Foo=ctx.foo;
This code means foo would no longer be a reference to its original object. And it really is an easy fix:
varfoo=ctx.foo;
Just let the compiler type it for you. Alternatively:
varfoo:Reference<Foo> =ctx.foo;
Type it yourself. I personally prefer the former solution, because I don't have to try as hard to make it a habit to think about what's referencing what.