From 9b4748ae7176d1fcb3fbd4998e67a3076a0df2cb Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Sat, 25 May 2013 20:51:15 -0400 Subject: [PATCH] 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! --- indra/newview/scriptcounter.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/indra/newview/scriptcounter.cpp b/indra/newview/scriptcounter.cpp index 754e7c43d..45b043b2d 100644 --- a/indra/newview/scriptcounter.cpp +++ b/indra/newview/scriptcounter.cpp @@ -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 + } } } }