-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
'duplicate()' error message + corruption #102573
Comments
Comes across to me as a sort of 'race' condition in your code. As in, the character is being duplicated while it is also being freed. This could also explain the corruption, as the duplication might then reference stale or corrupted data. One possible workaround in your code would be to add a boolean which you toggle before and after duplication. To then add a check on the code that calls the free. Only freeing it when it is not being duplicated. So the two processes, the duplication and the freeing do not accidentally get called simultaneously. |
The duplicate is not freed early. Note that in the above images, the transition animation (ellipse expanding, fading between two scenes) is still playing- the duplicate will not be freed until after the entire animation finishes via the tween. I just placed a breakpoint on the Also, to be clear, the ORIGINAL character is not being freed whatsoever as part of this transition. |
I didn't mean it as an insult of your code, or anything like that. I simply have no access to the code. So, couldn't be sure you weren't pushing the engine to its breaking point. I've done that myself. Anyhow, thanks for the additional information. Something peculiar does indeed seem to be going on. |
From the error message this looks like a duplicate of #96246, in this case the error only appears when duplicating a node with internal child nodes (the internal nodes wasn't being duplicated and raise the child count difference error). |
Tested versions
v4.4.beta1.official [d33da79]
v4.4.beta2.official [a013481]
v4.4.beta3.official [06acfcc]
System information
Godot v4.4.beta3 - Windows 10 (build 19045) - Multi-window, 1 monitor - Vulkan (Mobile) - dedicated AMD Radeon RX 6600 (Advanced Micro Devices, Inc.; 32.0.11027.2001) - AMD Ryzen 5 3600 6-Core Processor (12 threads)
Issue description
For a transition effect I have between two scenes, I create a duplicate of my entire player character.
Issue # 1 with this (random error message, appears to occur whenever this code duplicates the player. No idea why it happens.)
Issue # 2: Only under some circumstances (it appears to be after I've died and respawned; but, the only thing that does that should be relevant is it frees the player character, then re-instantiates it from its' scene again...), duplicating the player results in a quite corrupted duplicate.
Normal looking:
![Image](https://private-user-images.githubusercontent.com/35015090/411202561-8de0eaa5-0920-4f6b-b88c-2261a47b3281.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NDI0MDYsIm5iZiI6MTczOTQ0MjEwNiwicGF0aCI6Ii8zNTAxNTA5MC80MTEyMDI1NjEtOGRlMGVhYTUtMDkyMC00ZjZiLWI4OGMtMjI2MWE0N2IzMjgxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDEwMjE0NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQzYTMwM2I0M2M1ZDVlODEzNzEzNjRlNzE4YTQ2Njc4NTA3NTRiN2ViNDJlNDJmOWRmNGExOGQxN2IwNTU0MDEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.vX36fNQB2EC-E8ko0zJpQKZeK-SCkfrzkduhJKGtZlQ)
Corrupted:
![Image](https://private-user-images.githubusercontent.com/35015090/411202442-eac7423f-ff88-4602-8d3e-26f1c23fee52.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NDI0MDYsIm5iZiI6MTczOTQ0MjEwNiwicGF0aCI6Ii8zNTAxNTA5MC80MTEyMDI0NDItZWFjNzQyM2YtZmY4OC00NjAyLThkM2UtMjZmMWMyM2ZlZTUyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDEwMjE0NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQyMmJiN2M4MjNmMTgxM2I5NDhiNzg4ZTY3Zjc5ZDExNzdkNDExNTExNDQ2NDI0NDdlNTdkNjhiZjBiODE0MzMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.ZhuRmGvYo_Tz_so91oxSbxJg1g1OI6RPbSHecvdPAVM)
I have no clue what's wrong here, all I'm doing is calling
duplicate()
and expecting it to create a duplicate. Will add more details if I manage to find any, but I've been bashing my head at this for hours and making no further headway.Steps to reproduce
I have no idea how to easily reproduce it, it isn't even every time I duplicate the player in the code. Duplicating it in other places sometimes works fine. I would expect a timing issue of some sort, but even placing everything related to the issue in a lambda and then using
call_deferred
on that lambda to delay it all creates an identical result.Minimal reproduction project (MRP)
Wish I could reproduce it simpler....
The text was updated successfully, but these errors were encountered: