diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index fe4c91cb5696..be7c4c5d31b8 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -1535,6 +1535,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(); } @@ -1564,6 +1565,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); @@ -2181,6 +2183,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)); diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 99678051346a..ee6f872d7d2a 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -2651,6 +2651,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); diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 26141663c1c5..380c560ecaa8 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -6528,6 +6528,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); diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 33e72428cfb0..d545589d5765 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -761,6 +761,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 { diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 6b5ff23436e7..2f66c693533c 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -7387,6 +7387,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);