@@ -700,6 +700,7 @@ class LLWearableHoldingPattern
700
700
void onFetchCompletion ();
701
701
bool isFetchCompleted ();
702
702
bool isTimedOut ();
703
+ bool pollStopped ();
703
704
704
705
void checkMissingWearables ();
705
706
bool pollMissingWearables ();
@@ -944,6 +945,10 @@ bool LLWearableHoldingPattern::pollFetchCompletion()
944
945
{
945
946
// runway skip here?
946
947
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 ;
947
952
}
948
953
949
954
bool completed = isFetchCompleted ();
@@ -1014,6 +1019,9 @@ void recovered_item_cb(const LLUUID& item_id, LLWearableType::EType type, LLView
1014
1019
{
1015
1020
// runway skip here?
1016
1021
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 ;
1017
1025
}
1018
1026
1019
1027
LL_DEBUGS (" Avatar" ) << self_av_string () << " Recovered item for type " << type << LL_ENDL;
@@ -1064,12 +1072,27 @@ bool LLWearableHoldingPattern::isMissingCompleted()
1064
1072
return mTypesToLink .size ()==0 && mTypesToRecover .size ()==0 ;
1065
1073
}
1066
1074
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
+
1067
1086
bool LLWearableHoldingPattern::pollMissingWearables ()
1068
1087
{
1069
1088
if (!isMostRecent ())
1070
1089
{
1071
1090
// runway skip here?
1072
1091
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 ;
1073
1096
}
1074
1097
1075
1098
bool timed_out = isTimedOut ();
0 commit comments