mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-05 21:35:37 +00:00
fix memleak in mp lobby.
This commit is contained in:
parent
b8a76bed9d
commit
eeb0165cd6
@ -190,7 +190,8 @@ bool lobby_info::process_gamelist_diff(const config& data)
|
|||||||
if(current_i->second->display_status == game_info::NEW) {
|
if(current_i->second->display_status == game_info::NEW) {
|
||||||
// This means the game never made it through to the user interface,
|
// This means the game never made it through to the user interface,
|
||||||
// so just deleting it is fine
|
// so just deleting it is fine
|
||||||
// TODO: don't we have to delete the pointer or am i missing something?
|
// TODO: use std::unique_ptr instead of deleting manually.
|
||||||
|
delete current_i->second;
|
||||||
games_by_id_.erase(current_i);
|
games_by_id_.erase(current_i);
|
||||||
} else {
|
} else {
|
||||||
current_i->second->display_status = game_info::DELETED;
|
current_i->second->display_status = game_info::DELETED;
|
||||||
@ -253,7 +254,7 @@ void lobby_info::sync_games_display_status()
|
|||||||
game_info_map::iterator i = games_by_id_.begin();
|
game_info_map::iterator i = games_by_id_.begin();
|
||||||
while(i != games_by_id_.end()) {
|
while(i != games_by_id_.end()) {
|
||||||
if(i->second->display_status == game_info::DELETED) {
|
if(i->second->display_status == game_info::DELETED) {
|
||||||
// TODO: don't we have to delete the pointer or am i missing something?
|
delete i->second;
|
||||||
i = games_by_id_.erase(i);
|
i = games_by_id_.erase(i);
|
||||||
} else {
|
} else {
|
||||||
i->second->display_status = game_info::CLEAN;
|
i->second->display_status = game_info::CLEAN;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user