[Mono-bugs] [Bug 78285][Nor] Changed - Graphics.DrawIcon memory leak ?

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu May 4 12:21:47 EDT 2006

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by xenomorph2 at onlinehome.de.


--- shadow/78285	2006-05-04 11:57:59.000000000 -0400
+++ shadow/78285.tmp.20987	2006-05-04 12:21:47.000000000 -0400
@@ -32,6 +32,15 @@
 temporary retention)
 As for keeping a cached bitmap it could be done in Icon.ToBitmap.
 However we still must return a clone of that bitmap when asked (and
 not just a reference) as we don't know if the caller will call Dispose
 on it. Not sure if it's worth the extra code ?!?
+------- Additional Comments From xenomorph2 at onlinehome.de  2006-05-04 12:21 -------
+Can't we keep a reference in Icon even if someone disposes the bitmap
+? A little test like "if (icon_bitmap != null) return icon_bitmap;" in
+ToBitmap () should be enough. If the bitmap is null we create it again.
+With that method we do not need to create a new bitmap all the time
+for Graphics.DrawIcon which saves some time when it get's called from
+System.Windows.Forms (ThemeWin32Classic DrawStatusBarPanel for example).

More information about the mono-bugs mailing list