From 2f10bcf5f57e2cc3f470492fef5f4ea939c458b8 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 3 Aug 2010 12:13:50 -0700 Subject: fix for unit test asserts --- indra/newview/llmediadataclient.cpp | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'indra/newview/llmediadataclient.cpp') diff --git a/indra/newview/llmediadataclient.cpp b/indra/newview/llmediadataclient.cpp index 1de9d1c9b0..ec185bc790 100755 --- a/indra/newview/llmediadataclient.cpp +++ b/indra/newview/llmediadataclient.cpp @@ -265,13 +265,16 @@ void LLMediaDataClient::trackRequest(request_ptr_t request) { request_set_t::iterator iter = mUnQueuedRequests.lower_bound(request); - if(*iter == request) + if (iter != mUnQueuedRequests.end()) { - LL_WARNS("LLMediaDataClient") << "Tracking already tracked request: " << *request << LL_ENDL; - } - else - { - mUnQueuedRequests.insert(iter, request); + if(*iter == request) + { + LL_WARNS("LLMediaDataClient") << "Tracking already tracked request: " << *request << LL_ENDL; + } + else + { + mUnQueuedRequests.insert(iter, request); + } } } @@ -279,13 +282,16 @@ void LLMediaDataClient::stopTrackingRequest(request_ptr_t request) { request_set_t::iterator iter = mUnQueuedRequests.find(request); - if(*iter == request) + if (iter != mUnQueuedRequests.end()) { - mUnQueuedRequests.erase(iter); - } - else - { - LL_WARNS("LLMediaDataClient") << "Removing an untracked request: " << *request << LL_ENDL; + if(*iter == request) + { + mUnQueuedRequests.erase(iter); + } + else + { + LL_WARNS("LLMediaDataClient") << "Removing an untracked request: " << *request << LL_ENDL; + } } } -- cgit v1.2.3 From bd708f82bd3b87051e03a2794ce417ae6f432c08 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Mon, 9 Aug 2010 16:39:06 -0700 Subject: Patch on a fix for the llmediadataclient.cpp unit test. My refactor of LLMediaDataClient caused a crash in the windows unit test. Change set 92fd90bd795a fixed the crash, but broke the code in question. This changeset should make the code behave correctly, while removing some premature optimization that I now think didn't properly in the first place. --- indra/newview/llmediadataclient.cpp | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'indra/newview/llmediadataclient.cpp') diff --git a/indra/newview/llmediadataclient.cpp b/indra/newview/llmediadataclient.cpp index ec185bc790..075f0ba3ec 100755 --- a/indra/newview/llmediadataclient.cpp +++ b/indra/newview/llmediadataclient.cpp @@ -263,18 +263,15 @@ void LLMediaDataClient::pushBack(request_ptr_t request) void LLMediaDataClient::trackRequest(request_ptr_t request) { - request_set_t::iterator iter = mUnQueuedRequests.lower_bound(request); + request_set_t::iterator iter = mUnQueuedRequests.find(request); - if (iter != mUnQueuedRequests.end()) + if(iter != mUnQueuedRequests.end()) { - if(*iter == request) - { - LL_WARNS("LLMediaDataClient") << "Tracking already tracked request: " << *request << LL_ENDL; - } - else - { - mUnQueuedRequests.insert(iter, request); - } + LL_WARNS("LLMediaDataClient") << "Tracking already tracked request: " << *request << LL_ENDL; + } + else + { + mUnQueuedRequests.insert(request); } } @@ -284,14 +281,11 @@ void LLMediaDataClient::stopTrackingRequest(request_ptr_t request) if (iter != mUnQueuedRequests.end()) { - if(*iter == request) - { - mUnQueuedRequests.erase(iter); - } - else - { - LL_WARNS("LLMediaDataClient") << "Removing an untracked request: " << *request << LL_ENDL; - } + mUnQueuedRequests.erase(iter); + } + else + { + LL_WARNS("LLMediaDataClient") << "Removing an untracked request: " << *request << LL_ENDL; } } -- cgit v1.2.3