[command] Make cancel safe to call from initialize (#2440)

Fixes #2388.
This commit is contained in:
Starlight220
2020-05-21 07:00:34 +03:00
committed by GitHub
parent 27f9a21a2c
commit 92380485c8
3 changed files with 32 additions and 23 deletions

View File

@@ -144,12 +144,12 @@ void CommandScheduler::Schedule(bool interruptible, Command* command) {
}
command->Initialize();
m_impl->scheduledCommands[command] = CommandState{interruptible};
for (auto&& action : m_impl->initActions) {
action(*command);
}
for (auto&& requirement : requirements) {
m_impl->requirements[requirement] = command;
}
for (auto&& action : m_impl->initActions) {
action(*command);
}
m_watchdog.AddEpoch(command->GetName() + ".Initialize()");
}
}