aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2016-08-22 03:55:01 +0100
committerUbitUmarov2016-08-22 03:55:01 +0100
commitc8a1d7e5a74161d51841d5abbe9b76a7da51c872 (patch)
tree4daee5dc2d84dcf9c525326fea1a568d63330f1d /OpenSim
parent (re)fix avatar standup from a child prim on object delete (diff)
downloadopensim-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')
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/BMP.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GIF.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/PNG.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs10
-rw-r--r--OpenSim/Region/PhysicsModules/ubOdeMeshing/SculptMap.cs20
7 files changed, 32 insertions, 50 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()
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/SculptMap.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/SculptMap.cs
index 1c75db6..2ca2af7 100644
--- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/SculptMap.cs
+++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/SculptMap.cs
@@ -57,7 +57,7 @@ namespace PrimMesher
57 int numLodPixels = lod * lod; // (32 * 2)^2 = 64^2 pixels for default sculpt map image 57 int numLodPixels = lod * lod; // (32 * 2)^2 = 64^2 pixels for default sculpt map image
58 58
59 bool needsScaling = false; 59 bool needsScaling = false;
60 bool smallMap = false; 60 bool smallMap = false;
61 61
62 width = bmW; 62 width = bmW;
63 height = bmH; 63 height = bmH;
@@ -69,16 +69,8 @@ namespace PrimMesher
69 needsScaling = true; 69 needsScaling = true;
70 } 70 }
71 71
72 try 72 if (needsScaling)
73 { 73 bm = ScaleImage(bm, width, height);
74 if (needsScaling)
75 bm = ScaleImage(bm, width, height);
76 }
77
78 catch (Exception e)
79 {
80 throw new Exception("Exception in ScaleImage(): e: " + e.ToString());
81 }
82 74
83 if (width * height > numLodPixels) 75 if (width * height > numLodPixels)
84 { 76 {
@@ -129,11 +121,15 @@ namespace PrimMesher
129 } 121 }
130 catch (Exception e) 122 catch (Exception e)
131 { 123 {
124 if (needsScaling)
125 bm.Dispose();
132 throw new Exception("Caught exception processing byte arrays in SculptMap(): e: " + e.ToString()); 126 throw new Exception("Caught exception processing byte arrays in SculptMap(): e: " + e.ToString());
133 } 127 }
134 128
135 width++; 129 width++;
136 height++; 130 height++;
131 if(needsScaling)
132 bm.Dispose();
137 } 133 }
138 134
139 public List<List<Coord>> ToRows(bool mirror) 135 public List<List<Coord>> ToRows(bool mirror)
@@ -168,11 +164,9 @@ namespace PrimMesher
168 164
169 private Bitmap ScaleImage(Bitmap srcImage, int destWidth, int destHeight) 165 private Bitmap ScaleImage(Bitmap srcImage, int destWidth, int destHeight)
170 { 166 {
171
172 Bitmap scaledImage = new Bitmap(destWidth, destHeight, PixelFormat.Format24bppRgb); 167 Bitmap scaledImage = new Bitmap(destWidth, destHeight, PixelFormat.Format24bppRgb);
173 168
174 Color c; 169 Color c;
175
176 170
177 // will let last step to be eventually diferent, as seems to be in sl 171 // will let last step to be eventually diferent, as seems to be in sl
178 172