From 4d61fa32ad871d8a10cb13721fc5086902331a73 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 25 Oct 2021 23:30:38 +0300 Subject: SL-15992 Crash rapidly switching gestures --- indra/newview/llgesturemgr.cpp | 70 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 7 deletions(-) (limited to 'indra/newview/llgesturemgr.cpp') 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); + } } } -- cgit v1.2.3 From 7e0e58c55f7ff24df1a452e796b22f028b14dbd9 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 7 Apr 2022 11:11:39 +0300 Subject: SL-17092 Fix a gesture upload crash --- indra/newview/llgesturemgr.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'indra/newview/llgesturemgr.cpp') diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index bd881f8e7a..489d34edca 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -483,8 +483,13 @@ void LLGestureMgr::replaceGesture(const LLUUID& item_id, LLMultiGesture* new_ges mActive[base_item_id] = new_gesture; - delete old_gesture; - old_gesture = NULL; + // replaceGesture(const LLUUID& item_id, const LLUUID& new_asset_id) + // replaces ids without repalcing gesture + if (old_gesture != new_gesture) + { + delete old_gesture; + old_gesture = NULL; + } if (asset_id.notNull()) { @@ -1107,7 +1112,7 @@ void LLGestureMgr::onLoadComplete(const LLUUID& asset_uuid, else { LLMultiGesture* old_gesture = (*it).second; - if (old_gesture) + if (old_gesture && old_gesture != gesture) { LL_DEBUGS("GestureMgr") << "Received dupplicate " << item_id << " callback" << LL_ENDL; // In case somebody managest to activate, deactivate and -- cgit v1.2.3