Fix taya's linux crash, thanks to taya and router!
Crash was due to invalidated iterator
This commit is contained in:
@@ -139,34 +139,35 @@ void ScriptCounter::inventoryChanged(LLViewerObject* obj, LLInventoryObject::obj
|
|||||||
|
|
||||||
if (inv)
|
if (inv)
|
||||||
{
|
{
|
||||||
for (auto i = inv->begin(), end = inv->end(); i != end; ++i)
|
uuid_vec_t ids;
|
||||||
if (LLInventoryObject* asset = *i)
|
|
||||||
if (asset->getType() == LLAssetType::AT_LSL_TEXT)
|
for (auto asset : *inv)
|
||||||
|
{
|
||||||
|
const LLUUID& id = asset->getUUID();
|
||||||
|
if (asset->getType() == LLAssetType::AT_LSL_TEXT && id.notNull())
|
||||||
|
{
|
||||||
|
++scriptcount;
|
||||||
|
if (doDelete)
|
||||||
|
ids.push_back(id);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
const LLUUID& id = asset->getUUID();
|
LLMessageSystem* msg = gMessageSystem;
|
||||||
++scriptcount;
|
msg->newMessageFast(_PREHASH_GetScriptRunning);
|
||||||
if (doDelete)
|
msg->nextBlockFast(_PREHASH_Script);
|
||||||
{
|
msg->addUUIDFast(_PREHASH_ObjectID, obj->getID());
|
||||||
if (id.notNull())
|
msg->addUUIDFast(_PREHASH_ItemID, id);
|
||||||
{
|
msg->sendReliable(obj->getRegion()->getHost());
|
||||||
//LL_INFOS() << "Deleting script " << id << " in " << objid << LL_ENDL;
|
sCheckMap[id] = this;
|
||||||
obj->removeInventory(id);
|
++checking;
|
||||||
--i; // Avoid iteration when removing, everything has shifted
|
|
||||||
end = inv->end();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LLMessageSystem* msg = gMessageSystem;
|
|
||||||
msg->newMessageFast(_PREHASH_GetScriptRunning);
|
|
||||||
msg->nextBlockFast(_PREHASH_Script);
|
|
||||||
msg->addUUIDFast(_PREHASH_ObjectID, obj->getID());
|
|
||||||
msg->addUUIDFast(_PREHASH_ItemID, id);
|
|
||||||
msg->sendReliable(obj->getRegion()->getHost());
|
|
||||||
sCheckMap[id] = this;
|
|
||||||
++checking;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& id : ids)
|
||||||
|
{
|
||||||
|
//LL_INFOS() << "Deleting script " << id << " in " << objid << LL_ENDL;
|
||||||
|
obj->removeInventory(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
summarize();
|
summarize();
|
||||||
|
|||||||
Reference in New Issue
Block a user