guard against calling user_choice_manager::pull() recursively
(cherry-picked from commit 9593062fc6
)
This commit is contained in:
parent
0a32ffd16e
commit
222d29dfef
1 changed files with 13 additions and 1 deletions
|
@ -423,10 +423,22 @@ std::map<int, config> user_choice_manager::get_user_choice_internal(const std::s
|
|||
return man.res_;
|
||||
}
|
||||
|
||||
namespace {
|
||||
// we want to prevent calling pull() while we are already calling pull()
|
||||
// this could for example happen if pull() receives a [side_drop] and
|
||||
// user_choice_manager::process is called while the "player has left the game.
|
||||
// What do you want to do?" dialog is shown.
|
||||
static bool ucm_in_proccess = false;
|
||||
struct ucm_process_scope {
|
||||
ucm_process_scope() { ucm_in_proccess = true; }
|
||||
~ucm_process_scope() { ucm_in_proccess = false; }
|
||||
};
|
||||
}
|
||||
void user_choice_manager::process(events::pump_info&)
|
||||
{
|
||||
if(!oos_ && !finished())
|
||||
if(!oos_ && !finished() && !ucm_in_proccess)
|
||||
{
|
||||
ucm_process_scope scope1;
|
||||
pull();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue