SL-15992 Crash rapidly switching gestures

meow-7.2.2
Andrey Kleshchev 2021-10-25 23:30:38 +03:00
parent a926cdad1a
commit 4d61fa32ad
1 changed files with 62 additions and 6 deletions

View File

@ -910,7 +910,7 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture)
else if (gesture->mWaitTimer.getElapsedTimeF32() > MAX_WAIT_ANIM_SECS)
{
// we've waited too long for an animation
LL_INFOS() << "Waited too long for animations to stop, continuing gesture."
LL_INFOS("GestureMgr") << "Waited too long for animations to stop, continuing gesture."
<< LL_ENDL;
gesture->mWaitingAnimations = FALSE;
gesture->mCurrentStep++;
@ -1098,6 +1098,34 @@ void LLGestureMgr::onLoadComplete(LLVFS *vfs,
self.setFetchID(item_id);
self.startFetch();
}
item_map_t::iterator it = self.mActive.find(item_id);
if (it == self.mActive.end())
{
// Gesture is supposed to be present, active, but NULL
LL_DEBUGS("GestureMgr") << "Gesture " << item_id << " not found in active list" << LL_ENDL;
}
else
{
LLMultiGesture* old_gesture = (*it).second;
if (old_gesture)
{
LL_DEBUGS("GestureMgr") << "Received dupplicate " << item_id << " callback" << LL_ENDL;
// In case somebody managest to activate, deactivate and
// then activate gesture again, before asset finishes loading.
// LLLoadInfo will have a different pointer, asset storage will
// see it as a different request, resulting in two callbacks.
// deactivateSimilarGestures() did not turn this one off
// because of matching item_id
self.stopGesture(old_gesture);
self.mActive.erase(item_id);
delete old_gesture;
old_gesture = NULL;
}
}
self.mActive[item_id] = gesture;
// Everything has been successful. Add to the active list.
@ -1132,9 +1160,23 @@ void LLGestureMgr::onLoadComplete(LLVFS *vfs,
}
else
{
LL_WARNS() << "Unable to load gesture" << LL_ENDL;
LL_WARNS("GestureMgr") << "Unable to load gesture" << LL_ENDL;
self.mActive.erase(item_id);
item_map_t::iterator it = self.mActive.find(item_id);
if (it != self.mActive.end())
{
LLMultiGesture* old_gesture = (*it).second;
if (old_gesture)
{
// Shouldn't happen, just in case
LL_WARNS("GestureMgr") << "Gesture " << item_id << " existed when it shouldn't" << LL_ENDL;
self.stopGesture(old_gesture);
delete old_gesture;
old_gesture = NULL;
}
self.mActive.erase(item_id);
}
delete gesture;
gesture = NULL;
@ -1152,9 +1194,23 @@ void LLGestureMgr::onLoadComplete(LLVFS *vfs,
LLDelayedGestureError::gestureFailedToLoad( item_id );
}
LL_WARNS() << "Problem loading gesture: " << status << LL_ENDL;
LLGestureMgr::instance().mActive.erase(item_id);
LL_WARNS("GestureMgr") << "Problem loading gesture: " << status << LL_ENDL;
item_map_t::iterator it = self.mActive.find(item_id);
if (it != self.mActive.end())
{
LLMultiGesture* old_gesture = (*it).second;
if (old_gesture)
{
// Shouldn't happen, just in case
LL_WARNS("GestureMgr") << "Gesture " << item_id << " existed when it shouldn't" << LL_ENDL;
self.stopGesture(old_gesture);
delete old_gesture;
old_gesture = NULL;
}
self.mActive.erase(item_id);
}
}
}