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.integration
parent
568de9313a
commit
1369058280
|
@ -307,6 +307,13 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
|||
Graphics graph = null;
|
||||
|
||||
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)
|
||||
bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb);
|
||||
|
@ -337,6 +344,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
|||
}
|
||||
|
||||
GDIDraw(data, graph, altDataDelim);
|
||||
}
|
||||
|
||||
byte[] imageJ2000 = new byte[0];
|
||||
|
||||
|
@ -354,6 +362,13 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
|||
m_textureManager.ReturnData(id, imageJ2000);
|
||||
}
|
||||
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)
|
||||
graph.Dispose();
|
||||
|
@ -362,6 +377,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
|||
bitmap.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int parseIntParam(string strInt)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue