CreateBitmap(): Fail if it can not allocate bitmaps.

In init_interface_kit(), check the return value of MenuPrivate::CreateBitmaps()
and fail on error.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31964 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2009-07-30 12:11:41 +00:00
parent 7a8567e61d
commit eac9c5450f
2 changed files with 15 additions and 8 deletions
+5 -1
View File
@@ -954,11 +954,15 @@ _init_interface_kit_()
_init_global_fonts_(); _init_global_fonts_();
BPrivate::gWidthBuffer = new BPrivate::WidthBuffer; BPrivate::gWidthBuffer = new BPrivate::WidthBuffer;
BPrivate::MenuPrivate::CreateBitmaps(); status = BPrivate::MenuPrivate::CreateBitmaps();
if (status != B_OK)
return status;
_menu_info_ptr_ = &BMenu::sMenuInfo; _menu_info_ptr_ = &BMenu::sMenuInfo;
status = get_menu_info(&BMenu::sMenuInfo); status = get_menu_info(&BMenu::sMenuInfo);
if (status != B_OK)
return status;
general_info.background_color = ui_color(B_PANEL_BACKGROUND_COLOR); general_info.background_color = ui_color(B_PANEL_BACKGROUND_COLOR);
general_info.mark_color.set_to(0, 0, 0); general_info.mark_color.set_to(0, 0, 0);
+8 -5
View File
@@ -196,11 +196,14 @@ MenuPrivate::CreateBitmaps()
{ {
BRect smallRect(0, 0, 16, 10); BRect smallRect(0, 0, 16, 10);
BRect largeRect(0, 0, 21, 10); BRect largeRect(0, 0, 21, 10);
try {
gMenuItemAlt = new BBitmap(smallRect, B_CMAP8); gMenuItemAlt = new BBitmap(smallRect, B_CMAP8);
gMenuItemControl = new BBitmap(smallRect, B_CMAP8); gMenuItemControl = new BBitmap(smallRect, B_CMAP8);
gMenuItemOption = new BBitmap(smallRect, B_CMAP8); gMenuItemOption = new BBitmap(smallRect, B_CMAP8);
gMenuItemShift = new BBitmap(largeRect, B_CMAP8); gMenuItemShift = new BBitmap(largeRect, B_CMAP8);
} catch (...) {
return B_NO_MEMORY;
}
gMenuItemAlt->ImportBits(kAltBits, sizeof(kAltBits), gMenuItemAlt->ImportBits(kAltBits, sizeof(kAltBits),
17, 0, B_CMAP8); 17, 0, B_CMAP8);