aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/ubOdeMeshing
diff options
context:
space:
mode:
authorUbitUmarov2016-08-22 03:55:01 +0100
committerUbitUmarov2016-08-22 03:55:01 +0100
commitc8a1d7e5a74161d51841d5abbe9b76a7da51c872 (patch)
tree4daee5dc2d84dcf9c525326fea1a568d63330f1d /OpenSim/Region/PhysicsModules/ubOdeMeshing
parent (re)fix avatar standup from a child prim on object delete (diff)
downloadopensim-SC_OLD-c8a1d7e5a74161d51841d5abbe9b76a7da51c872.zip
opensim-SC_OLD-c8a1d7e5a74161d51841d5abbe9b76a7da51c872.tar.gz
opensim-SC_OLD-c8a1d7e5a74161d51841d5abbe9b76a7da51c872.tar.bz2
opensim-SC_OLD-c8a1d7e5a74161d51841d5abbe9b76a7da51c872.tar.xz
workaround potencial memory leaks
Diffstat (limited to 'OpenSim/Region/PhysicsModules/ubOdeMeshing')
-rw-r--r--OpenSim/Region/PhysicsModules/ubOdeMeshing/SculptMap.cs20
1 files changed, 7 insertions, 13 deletions
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