diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 0f1681a24e6..d765248cca8 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -539,15 +539,15 @@ BaseButton::BaseButton() { set_focus_mode(FOCUS_ALL); enabled_focus_mode = FOCUS_ALL; action_mode = ACTION_MODE_BUTTON_RELEASE; +} + +BaseButton::~BaseButton() { if (button_group.is_valid()) { button_group->buttons.erase(this); } } -BaseButton::~BaseButton() { -} - void ButtonGroup::get_buttons(List *r_buttons) { for (Set::Element *E = buttons.front(); E; E = E->next()) {