-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Prevent stack overflow when setting a shader global value #68799
Conversation
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.
Looks fine to me.
I looked into the issue and I can't find what causes the recursion. There is a UndoRedo set on ShaderGlobalsEditorInterface, but where it's triggered? The "Set Shader Global Variable" action only sets ProjectSettings. EDIT: Adding if (block_update) {
return false;
} at the beginning also fixes the issue. |
@KoBeWi You definitely need to check it with a debugger:
This works but this less elegant (and lead to the same result) |
Eh, something is fishy here. This fixes the immediate crash, but you can still crash if you mess with undo/redo. Although for whatever reason you can't normally undo setting shader global, you need to use History dock. Here's stack trace for the double set that causes the recursion:
Changing the property triggers inspector action which then callbacks to ShaderGlobalsEditorInterface and sets the value again. The reason for error is that another UndoRedo action is started while the previous one is being commited. I tested this recently and it would lead to the same result with the old UndoRedo system, so this code was borked from the beginning (or at least since someone messed up undo actions). Anyway, right now it's impossible to edit the values at all, so the PR is probably ok for now. |
Thanks! |
Should fix #68791. It's a regression of #59564, causes stack overflow (infinite recursion call of commit_action between
UndoRedo
/EditorUndoRedoManager
classes). There is still a bit buggy cuz it generates two Set calls (instead of one) and pushes them to history, but this prevents crashing at least.