Fix possible assertion violation in animations shutdown.

This commit is contained in:
John Preston 2019-12-31 13:48:16 +03:00
parent da3b4704bf
commit f0e95ee933
2 changed files with 8 additions and 0 deletions

View file

@ -113,6 +113,7 @@ void Manager::stop(not_null<Basic*> animation) {
const auto i = ranges::find(_active, value, proj);
if (i != end(_active)) {
*i = nullptr;
_removedWhileUpdating = true;
}
} else if (empty(_active)) {
stopTimer();
@ -138,6 +139,12 @@ void Manager::update() {
};
_active.erase(ranges::remove_if(_active, isFinished), end(_active));
if (_removedWhileUpdating) {
_removedWhileUpdating = false;
const auto proj = &ActiveBasicPointer::get;
_active.erase(ranges::remove(_active, nullptr, proj), end(_active));
}
if (!empty(_starting)) {
_active.insert(
end(_active),

View file

@ -198,6 +198,7 @@ private:
crl::time _lastUpdateTime = 0;
int _timerId = 0;
bool _updating = false;
bool _removedWhileUpdating = false;
bool _scheduled = false;
bool _forceImmediateUpdate = false;
std::vector<ActiveBasicPointer> _active;