Merge pull request #82171 from timothyqiu/sep-leak

Fix leak when calling `remove_control_from_menu_panel`
This commit is contained in:
Rémi Verschelde 2023-09-24 23:34:35 +02:00
commit 04317bc784
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 6 additions and 2 deletions

View file

@ -4979,9 +4979,11 @@ void CanvasItemEditor::remove_control_from_menu_panel(Control *p_control) {
p_control->disconnect("visibility_changed", callable_mp(this, &CanvasItemEditor::_update_context_toolbar));
context_toolbar_hbox->remove_child(context_toolbar_separators[p_control]);
VSeparator *sep = context_toolbar_separators[p_control];
context_toolbar_hbox->remove_child(sep);
context_toolbar_hbox->remove_child(p_control);
context_toolbar_separators.erase(p_control);
memdelete(sep);
_update_context_toolbar();
}

View file

@ -7695,9 +7695,11 @@ void Node3DEditor::remove_control_from_menu_panel(Control *p_control) {
p_control->disconnect("visibility_changed", callable_mp(this, &Node3DEditor::_update_context_toolbar));
context_toolbar_hbox->remove_child(context_toolbar_separators[p_control]);
VSeparator *sep = context_toolbar_separators[p_control];
context_toolbar_hbox->remove_child(sep);
context_toolbar_hbox->remove_child(p_control);
context_toolbar_separators.erase(p_control);
memdelete(sep);
_update_context_toolbar();
}