Fix taya's linux crash, thanks to taya and router!
Crash was due to invalidated iterator
This commit is contained in:
@@ -139,22 +139,16 @@ 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();
|
const LLUUID& id = asset->getUUID();
|
||||||
|
if (asset->getType() == LLAssetType::AT_LSL_TEXT && id.notNull())
|
||||||
|
{
|
||||||
++scriptcount;
|
++scriptcount;
|
||||||
if (doDelete)
|
if (doDelete)
|
||||||
{
|
ids.push_back(id);
|
||||||
if (id.notNull())
|
|
||||||
{
|
|
||||||
//LL_INFOS() << "Deleting script " << id << " in " << objid << LL_ENDL;
|
|
||||||
obj->removeInventory(id);
|
|
||||||
--i; // Avoid iteration when removing, everything has shifted
|
|
||||||
end = inv->end();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LLMessageSystem* msg = gMessageSystem;
|
LLMessageSystem* msg = gMessageSystem;
|
||||||
@@ -169,6 +163,13 @@ void ScriptCounter::inventoryChanged(LLViewerObject* obj, LLInventoryObject::obj
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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