From a4d224ff9316bf3b99e17f72f844d91e0ef80cc7 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Sat, 6 Feb 2010 21:38:57 +0000 Subject: EXT-5055 LLInstanceTracker promotes some dangerous patterns - detect them --- indra/llcommon/tests/llinstancetracker_test.cpp | 28 +++++++++++++++---------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'indra/llcommon/tests/llinstancetracker_test.cpp') diff --git a/indra/llcommon/tests/llinstancetracker_test.cpp b/indra/llcommon/tests/llinstancetracker_test.cpp index 7415f2d33b..4bb3ec2922 100644 --- a/indra/llcommon/tests/llinstancetracker_test.cpp +++ b/indra/llcommon/tests/llinstancetracker_test.cpp @@ -138,23 +138,29 @@ namespace tut keys.insert(&one); keys.insert(&two); keys.insert(&three); - for (Unkeyed::key_iter ki(Unkeyed::beginKeys()), kend(Unkeyed::endKeys()); - ki != kend; ++ki) - { - ensure_equals("spurious key", keys.erase(*ki), 1); - } + { + Unkeyed::LLInstanceTrackerScopedGuard guard; + for (Unkeyed::key_iter ki(guard.beginKeys()), kend(guard.endKeys()); + ki != kend; ++ki) + { + ensure_equals("spurious key", keys.erase(*ki), 1); + } + } ensure_equals("unreported key", keys.size(), 0); KeySet instances; instances.insert(&one); instances.insert(&two); instances.insert(&three); - for (Unkeyed::instance_iter ii(Unkeyed::beginInstances()), iend(Unkeyed::endInstances()); - ii != iend; ++ii) - { - Unkeyed& ref = *ii; - ensure_equals("spurious instance", instances.erase(&ref), 1); - } + { + Unkeyed::LLInstanceTrackerScopedGuard guard; + for (Unkeyed::instance_iter ii(guard.beginInstances()), iend(guard.endInstances()); + ii != iend; ++ii) + { + Unkeyed& ref = *ii; + ensure_equals("spurious instance", instances.erase(&ref), 1); + } + } ensure_equals("unreported instance", instances.size(), 0); } } // namespace tut -- cgit v1.2.3