In XBakesModule.Get() use using() to always dispose of RestClient which disposes the stream rather than disposing the stream directly

mb-throttle-test
Justin Clark-Casey (justincc) 2014-12-20 01:46:32 +00:00
parent e3d07bd0cc
commit 9cff0bbd7c
1 changed files with 35 additions and 31 deletions

View File

@ -103,7 +103,9 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
return null; return null;
int size = 0; int size = 0;
RestClient rc = new RestClient(m_URL);
using (RestClient rc = new RestClient(m_URL))
{
List<WearableCacheItem> ret = new List<WearableCacheItem>(); List<WearableCacheItem> ret = new List<WearableCacheItem>();
rc.AddResourcePath("bakes"); rc.AddResourcePath("bakes");
rc.AddResourcePath(id.ToString()); rc.AddResourcePath(id.ToString());
@ -112,7 +114,8 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
try try
{ {
using (Stream s = rc.Request(m_Auth)) Stream s = rc.Request(m_Auth);
using (XmlTextReader sr = new XmlTextReader(s)) using (XmlTextReader sr = new XmlTextReader(s))
{ {
sr.ReadStartElement("BakedAppearance"); sr.ReadStartElement("BakedAppearance");
@ -146,6 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
return null; return null;
} }
} }
}
public void Store(UUID agentId, WearableCacheItem[] data) public void Store(UUID agentId, WearableCacheItem[] data)
{ {