VisualBuilder: Make widget deletion work properly.

This commit is contained in:
Andreas Kling 2019-04-19 22:52:13 +02:00
parent 440700b4cb
commit b64408a564
Notes: sideshowbarker 2024-07-19 14:39:16 +09:00

View File

@ -309,9 +309,13 @@ void VBForm::mouseup_event(GMouseEvent& event)
void VBForm::delete_selected_widgets()
{
for_each_selected_widget([this] (auto& widget) {
m_widgets.remove_first_matching([&widget] (auto& entry) { return entry == &widget; } );
Vector<VBWidget*> to_delete;
for_each_selected_widget([&] (auto& widget) {
to_delete.append(&widget);
});
for (auto& widget : to_delete)
m_widgets.remove_first_matching([&widget] (auto& entry) { return entry == widget; } );
on_widget_selected(single_selected_widget());
}
template<typename Callback>