Skip to content

Commit f36b95b

Browse files
committed
If multiple LLWearableHoldingPattern instances are waiting for completion, only the most recently created one should progress
1 parent 420a3f1 commit f36b95b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

indra/newview/llappearancemgr.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
10671086
bool 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

Comments
 (0)