@@ -695,6 +695,7 @@ class LLWearableHoldingPattern
695
695
void onFetchCompletion ();
696
696
bool isFetchCompleted ();
697
697
bool isTimedOut ();
698
+ bool pollStopped ();
698
699
699
700
void checkMissingWearables ();
700
701
bool pollMissingWearables ();
@@ -939,6 +940,10 @@ bool LLWearableHoldingPattern::pollFetchCompletion()
939
940
{
940
941
// runway skip here?
941
942
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 ;
942
947
}
943
948
944
949
bool completed = isFetchCompleted ();
@@ -1009,6 +1014,9 @@ void recovered_item_cb(const LLUUID& item_id, LLWearableType::EType type, LLView
1009
1014
{
1010
1015
// runway skip here?
1011
1016
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 ;
1012
1020
}
1013
1021
1014
1022
LL_DEBUGS (" Avatar" ) << self_av_string () << " Recovered item for type " << type << LL_ENDL;
@@ -1059,12 +1067,27 @@ bool LLWearableHoldingPattern::isMissingCompleted()
1059
1067
return mTypesToLink .size ()==0 && mTypesToRecover .size ()==0 ;
1060
1068
}
1061
1069
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
+
1062
1081
bool LLWearableHoldingPattern::pollMissingWearables ()
1063
1082
{
1064
1083
if (!isMostRecent ())
1065
1084
{
1066
1085
// runway skip here?
1067
1086
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 ;
1068
1091
}
1069
1092
1070
1093
bool timed_out = isTimedOut ();
0 commit comments