diff --git a/src/gui/dialogs/multiplayer/mp_join_game.cpp b/src/gui/dialogs/multiplayer/mp_join_game.cpp index 4f84fffd42bd..1f3e6bc13ef5 100644 --- a/src/gui/dialogs/multiplayer/mp_join_game.cpp +++ b/src/gui/dialogs/multiplayer/mp_join_game.cpp @@ -456,6 +456,12 @@ void mp_join_game::generate_side_list(window& window) // const auto handler = [this, side_num](bool& handled, bool& halt) { show_flg_select(side_num); + // note: this function is called from a std::function object stored in the widget + // and show_flg_select which internally calls + // show_dialog -> pump -> ... -> network_handler -> ... -> generate_side_list + // might destroy that std::function object while it is executed, this means that + // using the captured variables 'this' and 'side_num' after this will result in + // unexpected behaviour or crashes. handled = halt = true; };