migueldeicaza / SwiftGodot

New Godot bindings for Swift
https://migueldeicaza.github.io/SwiftGodotDocs/tutorials/swiftgodot-tutorials/
MIT License
1.07k stars 70 forks source link

Ref/RefCounted memory management. #377

Open migueldeicaza opened 7 months ago

migueldeicaza commented 7 months ago

After some discussion with the Godot folks:

We probably want this on RefCounted deinit {}

The longer story is that RefCounted is exposed as a Ref.

We should also figure out when we own the reference and when we do not.

It seems that return from functions, we do not need to call reference, we own it. But parameters to callbacks, we would need to take a reference when we wrap (and let the deinitializer call the unreference)