Prevent dispose of Static StringName#23
Conversation
5b385c6 to
29ee39c
Compare
|
While testing, when quitting a scene I no longer get the unreferenced string errors but I now get a couple of orphaned stringNames: this is on top of all the |
|
I'm not sure we want to ensure static StringNames are only instantiated once. I feel like this makes StringName more complicated and I'd prefer to keep primitive types like StringName very simple. If we need a mechanism to avoid creating the same StringName more than once, we may want to implement such mechanism on top of StringName rather than modifying the StringName type itself, but I'm not sure we need it. Since the motivation behind this PR is to fix #20, let's try to figure out if there's a simpler way to fix this (I've commented on that issue: #20 (comment)). |
I kept the static StringName instantiated only once in this pr because I did not find how to determine whether the native StringName passed by godot is a static StringName. If the native StringName is static, but the instance created by c# is not static, then the c# instance It will be recycled by gc soon and trigger the recycling of native StringName, eventually causing the static StringName reference in godot to be 0. |
29ee39c to
abf44e7
Compare
|
There are now more users adding new features to the latest commit and they are able to use it. Please check if your PR is still valid and making improvement |
|
@raulsntos Should the |
|
We have the But I think what you are saying is the problem is not with StringNames created from C# user code, but StringNames coming from C++ through marshalling, is that correct? In that case, I believe we are copying the StringName (or should be) so there should be no problem in freeing the copied StringName. Let me know if I'm misunderstanding the issue. |
#20 (comment) |

Try fix #20 again