mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-08 01:28:29 +00:00
MP Manager: avoid setting singleton ptr until connection is established
This commit is contained in:
parent
1f7a0e2a13
commit
cd120f5118
@ -160,9 +160,6 @@ mp_manager::mp_manager(const std::optional<std::string> host)
|
|||||||
, state()
|
, state()
|
||||||
, lobby_info(::installed_addons())
|
, lobby_info(::installed_addons())
|
||||||
{
|
{
|
||||||
assert(!manager);
|
|
||||||
manager = this;
|
|
||||||
|
|
||||||
state.classification().campaign_type = game_classification::CAMPAIGN_TYPE::MULTIPLAYER;
|
state.classification().campaign_type = game_classification::CAMPAIGN_TYPE::MULTIPLAYER;
|
||||||
|
|
||||||
if(host) {
|
if(host) {
|
||||||
@ -214,6 +211,11 @@ mp_manager::mp_manager(const std::optional<std::string> host)
|
|||||||
received_initial_gamelist.get_future().wait();
|
received_initial_gamelist.get_future().wait();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Avoid setting this until the connection has been fully established. open_connection may throw,
|
||||||
|
// in which case we don't want to point to an object instance that has not properly connected.
|
||||||
|
assert(!manager);
|
||||||
|
manager = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<wesnothd_connection> mp_manager::open_connection(std::string host)
|
std::unique_ptr<wesnothd_connection> mp_manager::open_connection(std::string host)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user