diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-10-25 23:30:38 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-10-26 00:20:26 +0300 |
commit | 4d61fa32ad871d8a10cb13721fc5086902331a73 (patch) | |
tree | d609fd43d4eeac449b699a53c3d975ec26ad9b4e /indra/newview | |
parent | a926cdad1a896d61cf10478af96f4c0bb0703431 (diff) |
SL-15992 Crash rapidly switching gestures
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llgesturemgr.cpp | 70 |
1 files changed, 63 insertions, 7 deletions
diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 950a6cfaef..5619c8a077 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -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; - - self.mActive.erase(item_id); + LL_WARNS("GestureMgr") << "Unable to load gesture" << 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); + } 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); + } } } |