diff options
author | UbitUmarov | 2016-08-22 03:55:01 +0100 |
---|---|---|
committer | UbitUmarov | 2016-08-22 03:55:01 +0100 |
commit | c8a1d7e5a74161d51841d5abbe9b76a7da51c872 (patch) | |
tree | 4daee5dc2d84dcf9c525326fea1a568d63330f1d /OpenSim/Region/CoreModules/World | |
parent | (re)fix avatar standup from a child prim on object delete (diff) | |
download | opensim-SC-c8a1d7e5a74161d51841d5abbe9b76a7da51c872.zip opensim-SC-c8a1d7e5a74161d51841d5abbe9b76a7da51c872.tar.gz opensim-SC-c8a1d7e5a74161d51841d5abbe9b76a7da51c872.tar.bz2 opensim-SC-c8a1d7e5a74161d51841d5abbe9b76a7da51c872.tar.xz |
workaround potencial memory leaks
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
6 files changed, 25 insertions, 37 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/BMP.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/BMP.cs index 8b95a33..ec2d085 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/BMP.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/BMP.cs | |||
@@ -47,9 +47,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
47 | /// <param name="map">The terrain channel being saved</param> | 47 | /// <param name="map">The terrain channel being saved</param> |
48 | public override void SaveFile(string filename, ITerrainChannel map) | 48 | public override void SaveFile(string filename, ITerrainChannel map) |
49 | { | 49 | { |
50 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 50 | using(Bitmap colours = CreateGrayscaleBitmapFromMap(map)) |
51 | 51 | colours.Save(filename,ImageFormat.Bmp); | |
52 | colours.Save(filename, ImageFormat.Bmp); | ||
53 | } | 52 | } |
54 | 53 | ||
55 | /// <summary> | 54 | /// <summary> |
@@ -59,9 +58,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
59 | /// <param name="map">The terrain channel being saved</param> | 58 | /// <param name="map">The terrain channel being saved</param> |
60 | public override void SaveStream(Stream stream, ITerrainChannel map) | 59 | public override void SaveStream(Stream stream, ITerrainChannel map) |
61 | { | 60 | { |
62 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 61 | using(Bitmap colours = CreateGrayscaleBitmapFromMap(map)) |
63 | 62 | colours.Save(stream,ImageFormat.Bmp); | |
64 | colours.Save(stream, ImageFormat.Bmp); | ||
65 | } | 63 | } |
66 | 64 | ||
67 | /// <summary> | 65 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GIF.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GIF.cs index 79cc50b..3843708 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GIF.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GIF.cs | |||
@@ -36,9 +36,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
36 | { | 36 | { |
37 | public override void SaveFile(string filename, ITerrainChannel map) | 37 | public override void SaveFile(string filename, ITerrainChannel map) |
38 | { | 38 | { |
39 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 39 | using(Bitmap colours = CreateGrayscaleBitmapFromMap(map)) |
40 | 40 | colours.Save(filename,ImageFormat.Gif); | |
41 | colours.Save(filename, ImageFormat.Gif); | ||
42 | } | 41 | } |
43 | 42 | ||
44 | /// <summary> | 43 | /// <summary> |
@@ -48,9 +47,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
48 | /// <param name="map">The terrain channel being saved</param> | 47 | /// <param name="map">The terrain channel being saved</param> |
49 | public override void SaveStream(Stream stream, ITerrainChannel map) | 48 | public override void SaveStream(Stream stream, ITerrainChannel map) |
50 | { | 49 | { |
51 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 50 | using(Bitmap colours = CreateGrayscaleBitmapFromMap(map)) |
52 | 51 | colours.Save(stream,ImageFormat.Gif); | |
53 | colours.Save(stream, ImageFormat.Gif); | ||
54 | } | 52 | } |
55 | 53 | ||
56 | public override string ToString() | 54 | public override string ToString() |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs index e8c719a..1e67f72 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs | |||
@@ -59,7 +59,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
59 | /// <returns>A terrain channel generated from the image.</returns> | 59 | /// <returns>A terrain channel generated from the image.</returns> |
60 | public virtual ITerrainChannel LoadFile(string filename) | 60 | public virtual ITerrainChannel LoadFile(string filename) |
61 | { | 61 | { |
62 | using (Bitmap b = new Bitmap(filename)) | 62 | using(Bitmap b = new Bitmap(filename)) |
63 | return LoadBitmap(b); | 63 | return LoadBitmap(b); |
64 | } | 64 | } |
65 | 65 | ||
@@ -111,9 +111,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
111 | /// <param name="map">The terrain channel being saved</param> | 111 | /// <param name="map">The terrain channel being saved</param> |
112 | public virtual void SaveFile(string filename, ITerrainChannel map) | 112 | public virtual void SaveFile(string filename, ITerrainChannel map) |
113 | { | 113 | { |
114 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 114 | using(Bitmap colours = CreateGrayscaleBitmapFromMap(map)) |
115 | 115 | colours.Save(filename,ImageFormat.Png); | |
116 | colours.Save(filename, ImageFormat.Png); | ||
117 | } | 116 | } |
118 | 117 | ||
119 | /// <summary> | 118 | /// <summary> |
@@ -123,9 +122,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
123 | /// <param name="map">The terrain channel being saved</param> | 122 | /// <param name="map">The terrain channel being saved</param> |
124 | public virtual void SaveStream(Stream stream, ITerrainChannel map) | 123 | public virtual void SaveStream(Stream stream, ITerrainChannel map) |
125 | { | 124 | { |
126 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 125 | using(Bitmap colours = CreateGrayscaleBitmapFromMap(map)) |
127 | 126 | colours.Save(stream,ImageFormat.Png); | |
128 | colours.Save(stream, ImageFormat.Png); | ||
129 | } | 127 | } |
130 | 128 | ||
131 | public virtual void SaveFile(ITerrainChannel m_channel, string filename, | 129 | public virtual void SaveFile(ITerrainChannel m_channel, string filename, |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs index 9cc767a..36c2bbf 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs | |||
@@ -59,9 +59,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
59 | 59 | ||
60 | public void SaveFile(string filename, ITerrainChannel map) | 60 | public void SaveFile(string filename, ITerrainChannel map) |
61 | { | 61 | { |
62 | Bitmap colours = CreateBitmapFromMap(map); | 62 | using(Bitmap colours = CreateBitmapFromMap(map)) |
63 | 63 | colours.Save(filename,ImageFormat.Jpeg); | |
64 | colours.Save(filename, ImageFormat.Jpeg); | ||
65 | } | 64 | } |
66 | 65 | ||
67 | /// <summary> | 66 | /// <summary> |
@@ -71,9 +70,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
71 | /// <param name="map">The terrain channel being saved</param> | 70 | /// <param name="map">The terrain channel being saved</param> |
72 | public void SaveStream(Stream stream, ITerrainChannel map) | 71 | public void SaveStream(Stream stream, ITerrainChannel map) |
73 | { | 72 | { |
74 | Bitmap colours = CreateBitmapFromMap(map); | 73 | using(Bitmap colours = CreateBitmapFromMap(map)) |
75 | 74 | colours.Save(stream,ImageFormat.Jpeg); | |
76 | colours.Save(stream, ImageFormat.Jpeg); | ||
77 | } | 75 | } |
78 | 76 | ||
79 | public virtual void SaveFile(ITerrainChannel m_channel, string filename, | 77 | public virtual void SaveFile(ITerrainChannel m_channel, string filename, |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/PNG.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/PNG.cs index c5c12ae..8ea8e9d 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/PNG.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/PNG.cs | |||
@@ -36,9 +36,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
36 | { | 36 | { |
37 | public override void SaveFile(string filename, ITerrainChannel map) | 37 | public override void SaveFile(string filename, ITerrainChannel map) |
38 | { | 38 | { |
39 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 39 | using(Bitmap colours = CreateGrayscaleBitmapFromMap(map)) |
40 | 40 | colours.Save(filename,ImageFormat.Png); | |
41 | colours.Save(filename, ImageFormat.Png); | ||
42 | } | 41 | } |
43 | 42 | ||
44 | /// <summary> | 43 | /// <summary> |
@@ -48,9 +47,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
48 | /// <param name="map">The terrain channel being saved</param> | 47 | /// <param name="map">The terrain channel being saved</param> |
49 | public override void SaveStream(Stream stream, ITerrainChannel map) | 48 | public override void SaveStream(Stream stream, ITerrainChannel map) |
50 | { | 49 | { |
51 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 50 | using(Bitmap colours = CreateGrayscaleBitmapFromMap(map)) |
52 | 51 | colours.Save(stream,ImageFormat.Png); | |
53 | colours.Save(stream, ImageFormat.Png); | ||
54 | } | 52 | } |
55 | 53 | ||
56 | public override string ToString() | 54 | public override string ToString() |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs index b416b82..d103a6f 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs | |||
@@ -36,9 +36,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
36 | { | 36 | { |
37 | public override void SaveFile(string filename, ITerrainChannel map) | 37 | public override void SaveFile(string filename, ITerrainChannel map) |
38 | { | 38 | { |
39 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 39 | using(Bitmap colours = CreateGrayscaleBitmapFromMap(map)) |
40 | 40 | colours.Save(filename,ImageFormat.Tiff); | |
41 | colours.Save(filename, ImageFormat.Tiff); | ||
42 | } | 41 | } |
43 | 42 | ||
44 | /// <summary> | 43 | /// <summary> |
@@ -48,9 +47,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
48 | /// <param name="map">The terrain channel being saved</param> | 47 | /// <param name="map">The terrain channel being saved</param> |
49 | public override void SaveStream(Stream stream, ITerrainChannel map) | 48 | public override void SaveStream(Stream stream, ITerrainChannel map) |
50 | { | 49 | { |
51 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 50 | using(Bitmap colours = CreateGrayscaleBitmapFromMap(map)) |
52 | 51 | colours.Save(stream,ImageFormat.Tiff); | |
53 | colours.Save(stream, ImageFormat.Tiff); | ||
54 | } | 52 | } |
55 | 53 | ||
56 | public override string ToString() | 54 | public override string ToString() |