-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Refactor and remove excessive calls of NOTIFICATION_THEME_CHANGED
#62845
Refactor and remove excessive calls of NOTIFICATION_THEME_CHANGED
#62845
Conversation
b73b6b6
to
ce57f31
Compare
ce57f31
to
ad1e6a7
Compare
Okay, originally the plan was to wait to set |
ad1e6a7
to
14b0754
Compare
Can you please rebase this now that #63318 is merged? |
14b0754
to
88facb5
Compare
c10e018
to
4bd2b01
Compare
Remembered I should update the documentation as well |
4bd2b01
to
93cba19
Compare
f642dad
to
ff69395
Compare
Marking as a draft temporarily, I want to tweak the documentation a bit and double check this is the best way to do things before this is reviewed/merged |
ff69395
to
bf568e3
Compare
NOTIFICATION_THEME_CHANGED
Ready for review :P |
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.
Some changes required, some nitpicks. This looks good overall. I'm yet to test this in practice, but the code looks solid! Great work.
PS. If I didn't mention some of the notes on window but did on control in the similar code, assume it applies to both.
65a66e5
to
eda1dce
Compare
@YuriSizov changes made :) |
eda1dce
to
05f0538
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.
Changes make sense to me and make the code's flow clearer IMO. I can't spot any immediate regressions and can't think of a possible regression in logic. The two linked issues are indeed fixed now.
Also needs a rebase, then should be good to go |
05f0538
to
1e112fb
Compare
██████╗░███████╗██████╗░░█████╗░░██████╗███████╗██████╗░ |
... and now a check is failing 🙃 okay, thankfully can reproduce the issue locally, will look into it later |
Poke-poke. Would be great to merge this soon! |
Sorry 😅 |
1e112fb
to
8fd07e4
Compare
8fd07e4
to
74eb2a7
Compare
Thanks! |
…THEME_CHANGED" This reverts commit 4b817a5. Fixes godotengine#64988. Fixes godotengine#64997. This caused several regressions (godotengine#64988, godotengine#64997, godotengine#64997 (comment)) which point at a flaw in the current logic: - `Control::NOTIFICATION_ENTER_TREE` triggers a *deferred* notification with `NOTIFCATION_THEME_CHANGED` as introduced in godotengine#62845. - Some classes use their `THEME_CHANGED` to cache theme items in member variables (e.g. `style_normal`, etc.), and use those member variables in `ENTER_TREE`, `READY`, `DRAW`, etc. Since the `THEME_CHANGE` notification is now deferred, they end up accessing invalid state and this can lead to not applying theme properly (e.g. for EditorHelp) or crashing (e.g. for EditorLog or CodeEdit). So we need to go back to the drawing board and see if `THEME_CHANGED` can be called earlier so that the previous logic still works? Or can we refactor all engine code to make sure that: - `ENTER_TREE` and similar do not depend on theme properties cached in member variables. - Or `THEME_CHANGE` does trigger a general UI update to make sure that any bad theme handling in `ENTER_TREE` and co. gets fixed when `THEME_CHANGE` does arrive for the first time. But that means having a temporary invalid (and possibly still crashing) state, and doing some computations twice which might be heavy (e.g. `EditorHelp::_update_doc()`).
Fixes (partially, see #62846) #50743
Fixes #62844
Fixes #61765
See the updated
NOTIFICATION_THEME_CHANGED
documentation for when it should be called.After this is merged, #62846 can be merged, and #50743 can be closed.