Skip to content

Commit

Permalink
Prevent some internal nodes being duplicated
Browse files Browse the repository at this point in the history
  • Loading branch information
AThousandShips committed Sep 5, 2024
1 parent b6223c0 commit d43896a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scene/gui/color_picker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,7 @@ void ColorPicker::_pick_button_pressed() {
picker_window->set_size(Vector2i(1, 1));
picker_window->connect(SceneStringName(visibility_changed), callable_mp(this, &ColorPicker::_pick_finished));
add_child(picker_window, false, INTERNAL_MODE_FRONT);
picker_window->force_parent_owned();
}
picker_window->popup();
}
Expand Down Expand Up @@ -1553,6 +1554,7 @@ void ColorPicker::_pick_button_pressed_legacy() {
picker_window->hide();
picker_window->set_transient(true);
add_child(picker_window, false, INTERNAL_MODE_FRONT);
picker_window->force_parent_owned();

picker_texture_rect = memnew(TextureRect);
picker_texture_rect->set_anchors_preset(Control::PRESET_FULL_RECT);
Expand Down Expand Up @@ -2172,6 +2174,7 @@ void ColorPickerButton::_update_picker() {
picker->set_anchors_and_offsets_preset(PRESET_FULL_RECT);
popup->add_child(picker);
add_child(popup, false, INTERNAL_MODE_FRONT);
popup->force_parent_owned();
picker->connect("color_changed", callable_mp(this, &ColorPickerButton::_color_changed));
popup->connect("about_to_popup", callable_mp(this, &ColorPickerButton::_about_to_popup));
popup->connect("popup_hide", callable_mp(this, &ColorPickerButton::_modal_closed));
Expand Down
1 change: 1 addition & 0 deletions scene/gui/line_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2450,6 +2450,7 @@ Key LineEdit::_get_menu_action_accelerator(const String &p_action) {
void LineEdit::_generate_context_menu() {
menu = memnew(PopupMenu);
add_child(menu, false, INTERNAL_MODE_FRONT);
menu->force_parent_owned();

menu_dir = memnew(PopupMenu);
menu_dir->add_radio_check_item(ETR("Same as Layout Direction"), MENU_DIR_INHERITED);
Expand Down
1 change: 1 addition & 0 deletions scene/gui/rich_text_label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6385,6 +6385,7 @@ Size2 RichTextLabel::get_minimum_size() const {
void RichTextLabel::_generate_context_menu() {
menu = memnew(PopupMenu);
add_child(menu, false, INTERNAL_MODE_FRONT);
menu->force_parent_owned();
menu->connect(SceneStringName(id_pressed), callable_mp(this, &RichTextLabel::menu_option));

menu->add_item(ETR("Copy"), MENU_COPY);
Expand Down
1 change: 1 addition & 0 deletions scene/gui/tab_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,7 @@ void TabContainer::set_all_tabs_in_front(bool p_in_front) {

remove_child(tab_bar);
add_child(tab_bar, false, all_tabs_in_front ? INTERNAL_MODE_FRONT : INTERNAL_MODE_BACK);
tab_bar->force_parent_owned();
}

bool TabContainer::is_all_tabs_in_front() const {
Expand Down
1 change: 1 addition & 0 deletions scene/gui/text_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7276,6 +7276,7 @@ Key TextEdit::_get_menu_action_accelerator(const String &p_action) {
void TextEdit::_generate_context_menu() {
menu = memnew(PopupMenu);
add_child(menu, false, INTERNAL_MODE_FRONT);
menu->force_parent_owned();

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

0 comments on commit d43896a

Please sign in to comment.