-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Avoid crash on exiting due to late prints #80161
Avoid crash on exiting due to late prints #80161
Conversation
Does this fix #79379? |
Very likely. |
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.
Makes a lot of sense to cleanup the singleton like this.
CC @KoBeWi for the discussion on static callable validation - but this PR is ready to merge as is IMO. |
If a static function depends on an instance, it shouldn't be static, no? |
819a0f5
to
7de3e02
Compare
7de3e02
to
b3a5e10
Compare
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.
Still seems good after changes.
Thanks! |
Fixes #80152.
UPDATE: Probably fixes #79379.
Bugsquad edit: And fixes #79506.
The MRP there adds a message when the
EditorNode
has already been destroyed. The most obvious fix is done here, which is just validating the singleton when a deferred call happens. The problem is that static calls in the message queue can't be validated.Now, there are potential alternatives to this fix that may be done instead of in addition:
a) Let the static callables have some sort of custom validation.
For instance, there's this call:
callable_mp_static(&EditorNode::_print_handler_impl).bind(p_string, p_error, p_rich).call_deferred();
With this approach it could become something like this:
callable_mp_static(&EditorNode::_print_handler_impl).bind(p_string, p_error, p_rich).add_validator([]() -> bool{ return EditorNode::get_singleton(); }).call_deferred();
b) Like a), but using a sentinel pointer:
callable_mp_static(&EditorNode::_print_handler_impl).bind(p_string, p_error, p_rich).add_validity_sentinel(&EditorNode::singleton).call_deferred();
c) Make all deferred calls of this kind via the object instance instead of static. That would enable the current validated call mechanism to do its magic.