Skip to content

Commit

Permalink
Merge pull request #82171 from timothyqiu/sep-leak
Browse files Browse the repository at this point in the history
Fix leak when calling `remove_control_from_menu_panel`
  • Loading branch information
akien-mga committed Sep 24, 2023
2 parents 64cde8a + 2d67ce4 commit 04317bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion editor/plugins/canvas_item_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
4 changes: 3 additions & 1 deletion editor/plugins/node_3d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 04317bc

Please sign in to comment.