workaround potencial memory leaks

This commit is contained in:
UbitUmarov
2016-08-22 03:55:01 +01:00
parent 426e8a798f
commit c8a1d7e5a7
7 changed files with 32 additions and 50 deletions

View File

@@ -47,9 +47,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
/// <param name="map">The terrain channel being saved</param>
public override void SaveFile(string filename, ITerrainChannel map)
{
Bitmap colours = CreateGrayscaleBitmapFromMap(map);
colours.Save(filename, ImageFormat.Bmp);
using(Bitmap colours = CreateGrayscaleBitmapFromMap(map))
colours.Save(filename,ImageFormat.Bmp);
}
/// <summary>
@@ -59,9 +58,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
/// <param name="map">The terrain channel being saved</param>
public override void SaveStream(Stream stream, ITerrainChannel map)
{
Bitmap colours = CreateGrayscaleBitmapFromMap(map);
colours.Save(stream, ImageFormat.Bmp);
using(Bitmap colours = CreateGrayscaleBitmapFromMap(map))
colours.Save(stream,ImageFormat.Bmp);
}
/// <summary>

View File

@@ -36,9 +36,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
{
public override void SaveFile(string filename, ITerrainChannel map)
{
Bitmap colours = CreateGrayscaleBitmapFromMap(map);
colours.Save(filename, ImageFormat.Gif);
using(Bitmap colours = CreateGrayscaleBitmapFromMap(map))
colours.Save(filename,ImageFormat.Gif);
}
/// <summary>
@@ -48,9 +47,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
/// <param name="map">The terrain channel being saved</param>
public override void SaveStream(Stream stream, ITerrainChannel map)
{
Bitmap colours = CreateGrayscaleBitmapFromMap(map);
colours.Save(stream, ImageFormat.Gif);
using(Bitmap colours = CreateGrayscaleBitmapFromMap(map))
colours.Save(stream,ImageFormat.Gif);
}
public override string ToString()

View File

@@ -59,7 +59,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
/// <returns>A terrain channel generated from the image.</returns>
public virtual ITerrainChannel LoadFile(string filename)
{
using (Bitmap b = new Bitmap(filename))
using(Bitmap b = new Bitmap(filename))
return LoadBitmap(b);
}
@@ -111,9 +111,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
/// <param name="map">The terrain channel being saved</param>
public virtual void SaveFile(string filename, ITerrainChannel map)
{
Bitmap colours = CreateGrayscaleBitmapFromMap(map);
colours.Save(filename, ImageFormat.Png);
using(Bitmap colours = CreateGrayscaleBitmapFromMap(map))
colours.Save(filename,ImageFormat.Png);
}
/// <summary>
@@ -123,9 +122,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
/// <param name="map">The terrain channel being saved</param>
public virtual void SaveStream(Stream stream, ITerrainChannel map)
{
Bitmap colours = CreateGrayscaleBitmapFromMap(map);
colours.Save(stream, ImageFormat.Png);
using(Bitmap colours = CreateGrayscaleBitmapFromMap(map))
colours.Save(stream,ImageFormat.Png);
}
public virtual void SaveFile(ITerrainChannel m_channel, string filename,

View File

@@ -59,9 +59,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
public void SaveFile(string filename, ITerrainChannel map)
{
Bitmap colours = CreateBitmapFromMap(map);
colours.Save(filename, ImageFormat.Jpeg);
using(Bitmap colours = CreateBitmapFromMap(map))
colours.Save(filename,ImageFormat.Jpeg);
}
/// <summary>
@@ -71,9 +70,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
/// <param name="map">The terrain channel being saved</param>
public void SaveStream(Stream stream, ITerrainChannel map)
{
Bitmap colours = CreateBitmapFromMap(map);
colours.Save(stream, ImageFormat.Jpeg);
using(Bitmap colours = CreateBitmapFromMap(map))
colours.Save(stream,ImageFormat.Jpeg);
}
public virtual void SaveFile(ITerrainChannel m_channel, string filename,

View File

@@ -36,9 +36,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
{
public override void SaveFile(string filename, ITerrainChannel map)
{
Bitmap colours = CreateGrayscaleBitmapFromMap(map);
colours.Save(filename, ImageFormat.Png);
using(Bitmap colours = CreateGrayscaleBitmapFromMap(map))
colours.Save(filename,ImageFormat.Png);
}
/// <summary>
@@ -48,9 +47,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
/// <param name="map">The terrain channel being saved</param>
public override void SaveStream(Stream stream, ITerrainChannel map)
{
Bitmap colours = CreateGrayscaleBitmapFromMap(map);
colours.Save(stream, ImageFormat.Png);
using(Bitmap colours = CreateGrayscaleBitmapFromMap(map))
colours.Save(stream,ImageFormat.Png);
}
public override string ToString()

View File

@@ -36,9 +36,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
{
public override void SaveFile(string filename, ITerrainChannel map)
{
Bitmap colours = CreateGrayscaleBitmapFromMap(map);
colours.Save(filename, ImageFormat.Tiff);
using(Bitmap colours = CreateGrayscaleBitmapFromMap(map))
colours.Save(filename,ImageFormat.Tiff);
}
/// <summary>
@@ -48,9 +47,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
/// <param name="map">The terrain channel being saved</param>
public override void SaveStream(Stream stream, ITerrainChannel map)
{
Bitmap colours = CreateGrayscaleBitmapFromMap(map);
colours.Save(stream, ImageFormat.Tiff);
using(Bitmap colours = CreateGrayscaleBitmapFromMap(map))
colours.Save(stream,ImageFormat.Tiff);
}
public override string ToString()