Lock disposal of separate gdi+ objects under different threads since this prevents malloc heap corruption seen under Ubuntu 10.04.1 and 11.04 - probably a libcairo issue
In testing, it appears that if multiple threads dispose of separate GDI+ objects simultaneously, the native malloc heap can become corrupted, possibly due to a double free(). This may be due to bugs in the underlying libcairo used by mono's libgdiplus.dll on Linux/OSX. These problems were seen with both libcario 1.10.2-6.1ubuntu3 and 1.8.10-2ubuntu1. They go away if disposal is perfomed under lock.0.7.3-extended
parent
ed99017271
commit
a70baa95d1
|
@ -307,6 +307,13 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||||
Graphics graph = null;
|
Graphics graph = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
// XXX: In testing, it appears that if multiple threads dispose of separate GDI+ objects simultaneously,
|
||||||
|
// the native malloc heap can become corrupted, possibly due to a double free(). This may be due to
|
||||||
|
// bugs in the underlying libcairo used by mono's libgdiplus.dll on Linux/OSX. These problems were
|
||||||
|
// seen with both libcario 1.10.2-6.1ubuntu3 and 1.8.10-2ubuntu1. They go away if disposal is perfomed
|
||||||
|
// under lock.
|
||||||
|
lock (this)
|
||||||
{
|
{
|
||||||
if (alpha == 256)
|
if (alpha == 256)
|
||||||
bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb);
|
bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb);
|
||||||
|
@ -337,6 +344,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||||
}
|
}
|
||||||
|
|
||||||
GDIDraw(data, graph, altDataDelim);
|
GDIDraw(data, graph, altDataDelim);
|
||||||
|
}
|
||||||
|
|
||||||
byte[] imageJ2000 = new byte[0];
|
byte[] imageJ2000 = new byte[0];
|
||||||
|
|
||||||
|
@ -354,6 +362,13 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||||
m_textureManager.ReturnData(id, imageJ2000);
|
m_textureManager.ReturnData(id, imageJ2000);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
{
|
||||||
|
// XXX: In testing, it appears that if multiple threads dispose of separate GDI+ objects simultaneously,
|
||||||
|
// the native malloc heap can become corrupted, possibly due to a double free(). This may be due to
|
||||||
|
// bugs in the underlying libcairo used by mono's libgdiplus.dll on Linux/OSX. These problems were
|
||||||
|
// seen with both libcario 1.10.2-6.1ubuntu3 and 1.8.10-2ubuntu1. They go away if disposal is perfomed
|
||||||
|
// under lock.
|
||||||
|
lock (this)
|
||||||
{
|
{
|
||||||
if (graph != null)
|
if (graph != null)
|
||||||
graph.Dispose();
|
graph.Dispose();
|
||||||
|
@ -362,6 +377,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||||
bitmap.Dispose();
|
bitmap.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private int parseIntParam(string strInt)
|
private int parseIntParam(string strInt)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue