mirror of
https://github.com/holub/mame
synced 2025-07-04 17:38:08 +03:00
font_windows.c: don't crash if no memory for bitmap [Peter Ferrie]
more graceful exit will occur when next malloc() fails, and condition might be temporary
This commit is contained in:
parent
490ed5ce9b
commit
9cf8308096
@ -169,6 +169,9 @@ bool osd_font_windows::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT
|
||||
// create a DIB to render to
|
||||
BYTE *bits;
|
||||
HBITMAP dib = CreateDIBSection(dummyDC, &info, DIB_RGB_COLORS, reinterpret_cast<VOID **>(&bits), NULL, 0);
|
||||
|
||||
if (dib)
|
||||
{
|
||||
HGDIOBJ oldbitmap = SelectObject(dummyDC, dib);
|
||||
|
||||
// clear the bitmap
|
||||
@ -253,6 +256,8 @@ bool osd_font_windows::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT
|
||||
// de-select the font and release the DC
|
||||
SelectObject(dummyDC, oldbitmap);
|
||||
DeleteObject(dib);
|
||||
}
|
||||
|
||||
SelectObject(dummyDC, oldfont);
|
||||
DeleteDC(dummyDC);
|
||||
return bitmap.valid();
|
||||
|
Loading…
Reference in New Issue
Block a user