-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Let user know about dead instances in deferred calls (reverted) #78987
Let user know about dead instances in deferred calls (reverted) #78987
Conversation
e6b9af8
to
3a6527d
Compare
This one would be good for 4.2 dev builds. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense and seems very beneficial
Thanks! |
So we also get a lot of "ERROR: Trying to execute a deferred call/notification/set on a previously freed instance. Consider using queue_free() instead of free()." from running tests (you can see the CI run for this very PR). How should we avoid that? |
I am sorry, but this also has to be either reverted or changed. It is far too common for users to run into a situation where this will throw an error. This will frustrate more users than it will help because the errors are unfixable most of the time. As example, user call_deferred() during process because they want to wait until something else happens. Also during process of another node it decides its time to complete the level and wipe the scene, or wipe the node that did call_deferred. Or another situation, you want to merge a lot potential calls and only execute the code ones (like, Control does this when you do queue_redraw() ). In this case, if the node is removed, its also completely fine the redraw does not happen and no error is shown. Most of the code in the engine using call_deferred() expects this behavior because it is what makes the most sense in those contexts. If it throws an error, it is entirely beyond the user ability to fix this error. I know the suggestion is to use I did not add error checking for this specific code for this reason here, which is that its extremely difficult to prevent these situations in a lot of scenarios. They just happen due to natural circumstances and the user should not receive an error. Error checking for the call itself (function name, arguments, etc) is fine and should remain because if this is wrong, then this is most likely unintended. Additionally, the engine uses these functions internally a lot so users will run into cases where they can't simply mute the error anyway. |
I propose the following courses of action: If you really want this, it should be called call_deferred_valid_instance() or something like that and make this check optional. |
Remember that also we have method.call_deferred() in callable too, so whathever is done, a new version of this needs to be added there too. Also on the scene multithreading code. Adding validated/unvalidated versions sounds like a lot of work. |
This is reverted by #80081. |
NVM realized #80081 still fails with that, I'm too tired to think clearly atm |
@AThousandShips What are you referring to? |
Went down a wrong rabbit hole with wondering if the log was flooded by this causing the space issues for the godot-cpp build, accidentally deleted instead of editing and only this comment got left |
Worth seeing if it reduces the frequency, but realized both that this occured before this got merged and also affects the revert PR so not directly causal |
Has it been merged to 4.2dev2 ? I had no issues with 4.2dev1, now my code is buggy with this when I use set_deffered, I don't understand how to solve it. Here's a conversation that I found on reddit for information https://www.reddit.com/r/godot/comments/15jhppb/please_help_constant_issues_with_queuefree/?sort=new |
It has been reverted in #80081, so it will be fixed in dev3 |
So users have a hint about why their games print weird error messages or crash on release.
Fixes #75802.
Maybe fixes #78788.
Maybe fixes #70910.