Skip to content

Commit

Permalink
fix crash in the ControllerManager::updateAllControllers when mContro…
Browse files Browse the repository at this point in the history
…llers is changed while iterating over it
  • Loading branch information
Altren committed Sep 7, 2024
1 parent d111e9d commit d9c40c0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions OgreMain/src/OgreControllerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ namespace Ogre {
unsigned long thisFrameNumber = Root::getSingleton().getNextFrameNumber();
if (thisFrameNumber != mLastFrameNumber)
{
for (auto *ci : mControllers)
// intentionally do a loop using indices, because mControllers might change within the loop
for (size_t i = 0; i < mControllers.size(); ++i)
{
ci->update();
mControllers[i]->update();
}
mLastFrameNumber = thisFrameNumber;
}
Expand Down

0 comments on commit d9c40c0

Please sign in to comment.