[Mono-winforms-list] Matrix memory management in GDI+ bug
Sat, 12 Mar 2005 13:15:16 -0500
At 11:18 AM 12/03/2005 +0100, Laurent Debacker wrote:
>There's is a bug in the way mono manage the unmanaged matrix in libgdiplus.
>What I wanted to do is to save the transform matrix used in a Graphics
>object, save it in a global variable to reuse it later in other
>Graphics objects. It's just for optimization purpose.
>However Mono's System.Drawing.Drawing2D.Matrix doesn't behave like
>With Microsoft I can take the transform matrix from a matrix, even
>Dispose() it, then give it to another Graphics object, and it still
>works. I know it's tricky to Dispose() there, but I wanted to do
If Microsoft's implementation allows the Matrix to be used after it has
been Dispose()d, this would tend to indicate that they are actually storing
the matrix in managed memory, and that while a System.Drawing.Graphics has
an unmanaged matrix involved with the GDI+ operations, a
System.Drawing.Drawing2D.Matrix simply duplicates the matrix data in
managed memory. Changing mono to behave this way would be a lot more
logical than changing Dispose() to not perform its task.
This is probably something I could do myself :-) Jordi?