[Mono-bugs] [Bug 80151][Nor] Changed - [WIN] ResourceImageLoader.Get must be kept the stream alive
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Wed Jan 17 10:29:19 EST 2007
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 sebastien at ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=80151
--- shadow/80151 2007-01-15 15:23:53.000000000 -0500
+++ shadow/80151.tmp.394 2007-01-17 10:29:19.000000000 -0500
@@ -4,19 +4,19 @@
OS: Windows XP
OS Details:
Status: NEW
Resolution:
Severity: Unknown
Priority: Normal
-Component: Sys.Drawing.
-AssignedTo: sebastien at ximian.com
+Component: Windows.Forms
+AssignedTo: toshok at ximian.com
ReportedBy: monkey at jpobst.com
QAContact: mono-bugs at ximian.com
TargetMilestone: 1_2
URL:
-Summary: [Windows] Image Stream must be kept alive
+Summary: [WIN] ResourceImageLoader.Get must be kept the stream alive
The lines in DataGrid.cs:
- back_button_image.MakeTransparent (Color.Transparent);
- parent_rows_button_image.MakeTransparent (Color.Transparent);
cause an OutOfMemoryException when doing a new DataGrid () on Windows. The
@@ -45,6 +45,31 @@
memory chunk, that that stream or file or memory is "locked" by GDI+
for the life of the Bitmap or Image. In the case of stream or memory,
you must ensure the stream or memory stay's "alive" for the life of
the Image or Bitmap. "
-> moving to SD
+
+------- Additional Comments From sebastien at ximian.com 2007-01-17 10:29 -------
+The problem is fixed in System.Drawing.dll. However MWF does it's own
+loading of resources, from MimeIcon.cs:
+
+static internal Bitmap Get (string name)
+{
+ using (Stream stream = assembly.GetManifestResourceStream (name)) {
+ if (stream == null) {
+ Console.WriteLine ("Failed to read {0}", name);
+ return null;
+ }
+
+ return new Bitmap (stream);
+ }
+}
+
+Which is bad for the same reason, the stream is closed. So the same
+(OutOfMemory) error still occurs in the datagrid sample.
+
+MWF needs to use Bitmap.ctor(Type,string), but that would require some
+resource renaming, or keep track itself of the underlying stream under
+Win32.
+
+Moving back to MWF...
More information about the mono-bugs
mailing list