Skip to content

Commit

Permalink
fix infinite call loop on theme change.
Browse files Browse the repository at this point in the history
Apply suggestions from code review
  • Loading branch information
ajreckof committed May 5, 2024
1 parent 7ebc866 commit 1f833be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions editor/editor_inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,10 @@ StringName EditorProperty::_get_revert_property() const {
void EditorProperty::_update_property_bg() {
// This function is to be called on EditorPropertyResource, EditorPropertyArray, and EditorPropertyDictionary.
// Behavior is undetermined on any other EditorProperty.
if (!is_inside_tree()) {
if (!is_inside_tree() || updating_theme) {
return;
}

updating_theme = true;
begin_bulk_theme_override();

if (bottom_editor) {
Expand Down Expand Up @@ -529,6 +529,7 @@ void EditorProperty::_update_property_bg() {
remove_theme_color_override("property_color");
}
end_bulk_theme_override();
updating_theme = false;
queue_redraw();
}

Expand Down Expand Up @@ -4113,6 +4114,9 @@ void EditorInspector::_notification(int p_what) {

case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
bool needs_update = false;
if (EditorThemeManager::is_generated_theme_outdated() && !sub_inspector) {
add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("Tree")));
}

if (use_settings_name_style && EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/localize_settings")) {
EditorPropertyNameProcessor::Style style = EditorPropertyNameProcessor::get_settings_style();
Expand Down
1 change: 1 addition & 0 deletions editor/editor_inspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class EditorProperty : public Container {
Control *label_reference = nullptr;
Control *bottom_editor = nullptr;
PopupMenu *menu = nullptr;
bool updating_theme = false;

HashMap<StringName, Variant> cache;

Expand Down

0 comments on commit 1f833be

Please sign in to comment.