Remember to dispose of the bitmap opened from a file in GatekeeperServiceConnector.GetMapImage()

0.7.4.1
Justin Clark-Casey (justincc) 2012-04-20 03:32:38 +01:00
parent 63cda3a6d0
commit 4ac2f839bd
1 changed files with 11 additions and 4 deletions

View File

@ -154,7 +154,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
UUID mapTile = m_HGMapImage; UUID mapTile = m_HGMapImage;
string filename = string.Empty; string filename = string.Empty;
Bitmap bitmap = null;
try try
{ {
WebClient c = new WebClient(); WebClient c = new WebClient();
@ -167,11 +167,18 @@ namespace OpenSim.Services.Connectors.Hypergrid
c.DownloadFile(imageURL, filename); c.DownloadFile(imageURL, filename);
} }
else else
{
m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: using cached image"); m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: using cached image");
}
byte[] imageData = null;
using (Bitmap bitmap = new Bitmap(filename))
{
//m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width);
imageData = OpenJPEG.EncodeFromImage(bitmap, true);
}
bitmap = new Bitmap(filename);
//m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width);
byte[] imageData = OpenJPEG.EncodeFromImage(bitmap, true);
AssetBase ass = new AssetBase(UUID.Random(), "region " + name, (sbyte)AssetType.Texture, regionID.ToString()); AssetBase ass = new AssetBase(UUID.Random(), "region " + name, (sbyte)AssetType.Texture, regionID.ToString());
// !!! for now // !!! for now