Skip to content

Commit 5dcab0e

Browse files
Prevent some internal nodes being duplicated in Controls
1 parent 261e7d3 commit 5dcab0e

File tree

5 files changed

+7
-0
lines changed

5 files changed

+7
-0
lines changed

scene/gui/color_picker.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,6 +1741,7 @@ void ColorPicker::_pick_button_pressed() {
17411741
picker_preview_color->add_theme_style_override(SceneStringName(panel), picker_preview_style_box_color);
17421742

17431743
add_child(picker_window, false, INTERNAL_MODE_FRONT);
1744+
picker_window->force_parent_owned();
17441745
}
17451746
set_process_internal(true);
17461747

@@ -1889,6 +1890,7 @@ void ColorPicker::_pick_button_pressed_legacy() {
18891890
picker_window->hide();
18901891
picker_window->set_transient(true);
18911892
add_child(picker_window, false, INTERNAL_MODE_FRONT);
1893+
picker_window->force_parent_owned();
18921894

18931895
picker_texture_rect = memnew(TextureRect);
18941896
picker_texture_rect->set_anchors_preset(Control::PRESET_FULL_RECT);
@@ -2562,6 +2564,7 @@ void ColorPickerButton::_update_picker() {
25622564
picker->set_anchors_and_offsets_preset(PRESET_FULL_RECT);
25632565
popup->add_child(picker);
25642566
add_child(popup, false, INTERNAL_MODE_FRONT);
2567+
popup->force_parent_owned();
25652568
picker->connect("color_changed", callable_mp(this, &ColorPickerButton::_color_changed));
25662569
popup->connect("about_to_popup", callable_mp(this, &ColorPickerButton::_about_to_popup));
25672570
popup->connect("popup_hide", callable_mp(this, &ColorPickerButton::_modal_closed));

scene/gui/line_edit.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2701,6 +2701,7 @@ Key LineEdit::_get_menu_action_accelerator(const String &p_action) {
27012701
void LineEdit::_generate_context_menu() {
27022702
menu = memnew(PopupMenu);
27032703
add_child(menu, false, INTERNAL_MODE_FRONT);
2704+
menu->force_parent_owned();
27042705

27052706
menu_dir = memnew(PopupMenu);
27062707
menu_dir->add_radio_check_item(ETR("Same as Layout Direction"), MENU_DIR_INHERITED);

scene/gui/rich_text_label.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6834,6 +6834,7 @@ Size2 RichTextLabel::get_minimum_size() const {
68346834
void RichTextLabel::_generate_context_menu() {
68356835
menu = memnew(PopupMenu);
68366836
add_child(menu, false, INTERNAL_MODE_FRONT);
6837+
menu->force_parent_owned();
68376838
menu->connect(SceneStringName(id_pressed), callable_mp(this, &RichTextLabel::menu_option));
68386839

68396840
menu->add_item(ETR("Copy"), MENU_COPY);

scene/gui/tab_container.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,7 @@ void TabContainer::set_all_tabs_in_front(bool p_in_front) {
761761

762762
remove_child(tab_bar);
763763
add_child(tab_bar, false, all_tabs_in_front ? INTERNAL_MODE_FRONT : INTERNAL_MODE_BACK);
764+
tab_bar->force_parent_owned();
764765
}
765766

766767
bool TabContainer::is_all_tabs_in_front() const {

scene/gui/text_edit.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7364,6 +7364,7 @@ Key TextEdit::_get_menu_action_accelerator(const String &p_action) {
73647364
void TextEdit::_generate_context_menu() {
73657365
menu = memnew(PopupMenu);
73667366
add_child(menu, false, INTERNAL_MODE_FRONT);
7367+
menu->force_parent_owned();
73677368

73687369
menu_dir = memnew(PopupMenu);
73697370
menu_dir->add_radio_check_item(ETR("Same as Layout Direction"), MENU_DIR_INHERITED);

0 commit comments

Comments
 (0)