Fix deleting all scripts in selection

Two real changes: 1. Don't tell the user we're counting scripts when they just want them gone; 2. When deleting a script, counter-iterate to avoid a crash
Adds a bit more debug spew commented out, helped me out with this.

Thanks to Sentinel for catching this early!
This commit is contained in:
Lirusaito
2013-05-25 20:51:15 -04:00
parent 9d3cc2a03b
commit 9b4748ae71

View File

@@ -97,7 +97,7 @@ void ScriptCounter::requestInventories()
if (LLViewerObject* object = selectNode->getObject())
requestInventoriesFor(object);
}
cmdline_printchat(LLTrans::getString("ScriptCounting"));
if (!doDelete) cmdline_printchat(LLTrans::getString("ScriptCounting"));
requesting = false;
}
@@ -130,7 +130,8 @@ void ScriptCounter::inventoryChanged(LLViewerObject* obj, LLInventoryObject::obj
{
obj->removeInventoryListener(this);
--inventories;
//llinfos << "Counting scripts in " << obj->getID() << llendl;
//const LLUUID& objid = obj->getID();
//llinfos << "Counting scripts in " << objid << llendl;
if (inv)
{
@@ -144,7 +145,11 @@ void ScriptCounter::inventoryChanged(LLViewerObject* obj, LLInventoryObject::obj
{
const LLUUID& id = asset->getUUID();
if (id.notNull())
{
//llinfos << "Deleting script " << id << " in " << objid << llendl;
obj->removeInventory(id);
--i; // Avoid iteration when removing, everything has shifted
}
}
}
}