From d5067187362ff15d0e44afbb0a3e4952571795bd Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Mon, 16 May 2022 09:38:48 +0800 Subject: [PATCH] Fix crash when editing pinned StyleBox (cherry picked from commit 4b013a9c967ecc063801b3d4a0e833dcbc865f83) --- editor/plugins/theme_editor_plugin.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index 2c7777c428b..12a03a3f1b3 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -2682,11 +2682,13 @@ void ThemeTypeEditor::_update_stylebox_from_leading() { edited_theme->get_stylebox_list(edited_type, &names); List> styleboxes; for (List::Element *E = names.front(); E; E = E->next()) { - if (E->get() == leading_stylebox.item_name) { + Ref sb = edited_theme->get_stylebox(E->get(), edited_type); + + // Avoid itself, stylebox can be shared between items. + if (sb == leading_stylebox.stylebox) { continue; } - Ref sb = edited_theme->get_stylebox(E->get(), edited_type); if (sb->get_class() == leading_stylebox.stylebox->get_class()) { styleboxes.push_back(sb); }