@@ -695,6 +695,7 @@ class LLWearableHoldingPattern
695695 void onFetchCompletion ();
696696 bool isFetchCompleted ();
697697 bool isTimedOut ();
698+ bool pollStopped ();
698699
699700 void checkMissingWearables ();
700701 bool pollMissingWearables ();
@@ -939,6 +940,10 @@ bool LLWearableHoldingPattern::pollFetchCompletion()
939940 {
940941 // runway skip here?
941942 LL_WARNS () << self_av_string () << " skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
943+
944+ // If we were signalled to stop then we shouldn't do anything else except poll for when it's safe to delete ourselves
945+ doOnIdleRepeating (boost::bind (&LLWearableHoldingPattern::pollStopped, this ));
946+ return true ;
942947 }
943948
944949 bool completed = isFetchCompleted ();
@@ -1009,6 +1014,9 @@ void recovered_item_cb(const LLUUID& item_id, LLWearableType::EType type, LLView
10091014 {
10101015 // runway skip here?
10111016 LL_WARNS () << self_av_string () << " skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
1017+
1018+ // If we were signalled to stop then we shouldn't do anything else except poll for when it's safe to delete ourselves
1019+ return ;
10121020 }
10131021
10141022 LL_DEBUGS (" Avatar" ) << self_av_string () << " Recovered item for type " << type << LL_ENDL;
@@ -1059,12 +1067,27 @@ bool LLWearableHoldingPattern::isMissingCompleted()
10591067 return mTypesToLink .size ()==0 && mTypesToRecover .size ()==0 ;
10601068}
10611069
1070+ bool LLWearableHoldingPattern::pollStopped ()
1071+ {
1072+ // We have to keep on polling until we're sure that all callbacks have completed or they'll cause a crash
1073+ if (isFetchCompleted () && isMissingCompleted ())
1074+ {
1075+ delete this ;
1076+ return true ;
1077+ }
1078+ return false ;
1079+ }
1080+
10621081bool LLWearableHoldingPattern::pollMissingWearables ()
10631082{
10641083 if (!isMostRecent ())
10651084 {
10661085 // runway skip here?
10671086 LL_WARNS () << self_av_string () << " skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL;
1087+
1088+ // If we were signalled to stop then we shouldn't do anything else except poll for when it's safe to delete ourselves
1089+ doOnIdleRepeating (boost::bind (&LLWearableHoldingPattern::pollStopped, this ));
1090+ return true ;
10681091 }
10691092
10701093 bool timed_out = isTimedOut ();
0 commit comments