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:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user