-
-
Notifications
You must be signed in to change notification settings - Fork 21.8k
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
Should we allow recursive referencing in Dictionary/Array ? #35870
Comments
Another even better solution would be to simply define a recursion limit. The good think about this approach is it should be dead simple to implement and won't increase the algorithm complexity (unlike the previous solution for instance) |
I've implemented the recursion limit in my PR, see 0d8f573 ;-) |
Can you check the status in the current From a quick check the Dictionary example seems to properly catch and abort on infinite recursion (probably after #51068), but the Array case seems to still crash. |
Poke ;) |
No longer crashes, the recursion is handled properly:
|
While working on a new equal operator for Array and Dictionary (see #35816), I've encountered crash when dealing with recursive containers.
Example running with Godot 3.2:
Another with hash:
Another with array:
This lead me to think recursive container are a curiosity that are not well handled but not much people care about them (I couldn't find any issue about that).
However correctly handling recursive container is tricky (see my changes to my PR to implement this: 5c214d18c0f78b90a4bbb8a65a81926acabb9681, and I'm not really sure this is 100% correct :/)
On top of that recursive container end up in memory leaks with Godot (I'm not aware of a cyclic reference detector in Godot)...
So my question is "do we really want to support this ?" Or wouldn't be just fine to run recursive reference detection when adding a container to another container, and printing an error if such thing is detected ?
The text was updated successfully, but these errors were encountered: