@@ -700,6 +700,7 @@ class LLWearableHoldingPattern
700700 void onFetchCompletion ();
701701 bool isFetchCompleted ();
702702 bool isTimedOut ();
703+ bool pollStopped ();
703704
704705 void checkMissingWearables ();
705706 bool pollMissingWearables ();
@@ -944,6 +945,10 @@ bool LLWearableHoldingPattern::pollFetchCompletion()
944945 {
945946 // runway skip here?
946947 LL_WARNS () << self_av_string () << " skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
948+
949+ // If we were signalled to stop then we shouldn't do anything else except poll for when it's safe to delete ourselves
950+ doOnIdleRepeating (boost::bind (&LLWearableHoldingPattern::pollStopped, this ));
951+ return true ;
947952 }
948953
949954 bool completed = isFetchCompleted ();
@@ -1014,6 +1019,9 @@ void recovered_item_cb(const LLUUID& item_id, LLWearableType::EType type, LLView
10141019 {
10151020 // runway skip here?
10161021 LL_WARNS () << self_av_string () << " skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
1022+
1023+ // If we were signalled to stop then we shouldn't do anything else except poll for when it's safe to delete ourselves
1024+ return ;
10171025 }
10181026
10191027 LL_DEBUGS (" Avatar" ) << self_av_string () << " Recovered item for type " << type << LL_ENDL;
@@ -1064,12 +1072,27 @@ bool LLWearableHoldingPattern::isMissingCompleted()
10641072 return mTypesToLink .size ()==0 && mTypesToRecover .size ()==0 ;
10651073}
10661074
1075+ bool LLWearableHoldingPattern::pollStopped ()
1076+ {
1077+ // We have to keep on polling until we're sure that all callbacks have completed or they'll cause a crash
1078+ if (isFetchCompleted () && isMissingCompleted ())
1079+ {
1080+ delete this ;
1081+ return true ;
1082+ }
1083+ return false ;
1084+ }
1085+
10671086bool LLWearableHoldingPattern::pollMissingWearables ()
10681087{
10691088 if (!isMostRecent ())
10701089 {
10711090 // runway skip here?
10721091 LL_WARNS () << self_av_string () << " skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
1092+
1093+ // If we were signalled to stop then we shouldn't do anything else except poll for when it's safe to delete ourselves
1094+ doOnIdleRepeating (boost::bind (&LLWearableHoldingPattern::pollStopped, this ));
1095+ return true ;
10731096 }
10741097
10751098 bool timed_out = isTimedOut ();
0 commit comments