Open holgerschurig opened 4 years ago
The commit that introduced this behavior was https://github.com/mono/libgdiplus/commit/215632d4f8a98d4083e91395f4efe33fe369a091
Doing this:
git checkout 215632d4f8a98d4083e91395f4efe33fe369a091^
git clean -fdx
./autogen.sh
make -j8 && sudo cp -v src/.libs/libgdiplus.so.0.0.0 /usr/lib
will make the test program from above (gist https://gist.github.com/holgerschurig/d7358b623f874eb447d66511d9650b25) work without a crash. Note the ^ at the checkout to get the previous version.
Manually reverting hunks revealed that the following change introduced the crash:
@@ -800,27 +799,35 @@ GdipCreateBitmapFromScan0 (int width, int height, int stride, PixelFormat format
case PixelFormat16bppRGB565:
/* fake them as 32bpp RGB as Cairo deprecated CAIRO_FORMAT_RGB16_565 support */
/* why 32bpp ? because that's the result of MS GDI+ when loading them, even if the bitmap is
- format = PixelFormat32bppRGB;
- stride *= 2;
cairo_format = CAIRO_FORMAT_ARGB32;
break;
After I re-added these two lines, things worked again.
This worked even when I re-added these two lines to git master.
Thanks for the tip! Reverting this change didn't work for me, but changing "PixelFormat.Format16bppRgb555" in the host application to "PixelFormat.Format32bppRgb" worked around the issue for me. :)
Steps to reproduce
csc Program.cs Form1.cs Form1.Designer.cs
mono Program.exe
The 3 files can be found at https://gist.github.com/holgerschurig/d7358b623f874eb447d66511d9650b25
Current Behavior
Expected Behavior
I expect Mono to be able to allocate a bitmap of just 952x1051, especially when I have more than 6 GB of free RAM.
Additional Info
The above stacktrace is from my normal Debian 10 (Buster) x86 development box. But it happened first on a i.MX6Q (armhf architecture) box. On the same device, there used to be no problem. I found out that copying an old libgdiplus.so.0.0.0 from an old .deb (I think it was 4.2) "fixes" the problem.
I think the first version where I noticed this error was 6.0.4
On which platforms did you notice this
[ ] macOS [x] Linux [ ] Windows
Version Used