Skip to content

Commit

Permalink
Do not copy selected_cities
Browse files Browse the repository at this point in the history
The closure already captures the environment by value.
  • Loading branch information
blabber committed Jan 5, 2025
1 parent a5fab74 commit 3df41f9
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions client/views/view_cities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -728,10 +728,7 @@ void city_widget::sell(const struct impr_type *building)
ask->set_text_title(buf, _("Sell?"));
ask->setAttribute(Qt::WA_DeleteOnClose);
connect(ask, &hud_message_box::accepted, this, [=]() {
const auto saved_selection =
selected_cities; // Copy to avoid invalidations

for (auto *pcity : saved_selection) {
for (auto *pcity : selected_cities) {
int city_id = pcity->id;
if (nullptr == game_city_by_number(city_id)) {
continue;
Expand Down

0 comments on commit 3df41f9

Please sign in to comment.