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

Refcount for retainHaxeObject ? #52

Open
singpolyma opened this issue Mar 13, 2024 · 1 comment
Open

Refcount for retainHaxeObject ? #52

singpolyma opened this issue Mar 13, 2024 · 1 comment

Comments

@singpolyma
Copy link

Right now there is no refcount with retainHaxeObject. That means that if two methods are called which both return the same object (or the same method twice, etc) by different parts of the C code, then one part of the C code calls release the GC may free it even though there is still a reference on the C side.

@haxiomic
Copy link
Owner

haxiomic commented Apr 6, 2024

Agree and good catch
I think a simple fix could be changing the gcRetainMap from <ptr, Dynamic> to <ptr, { obj: Dynamic, refCount: Int }>

public static final gcRetainMap = new Int64Map<Dynamic>();

I'm not working on this repo at the moment but would accept patches for this

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

No branches or pull requests

2 participants