CComponentsHeader/CComponentsFooter: prevent crash on changed font settings

Default fonts for header and footer must be handled too.
After font settings changes these objects could be invalid.
Default fonts have invalid pointers after font changes too. Extra reset is required.
This commit is contained in:
2016-12-29 23:42:35 +01:00
parent 6a3b07152f
commit b98319cb91
4 changed files with 26 additions and 4 deletions

View File

@@ -68,6 +68,12 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const
//init footer width
width = w == 0 ? frameBuffer->getScreenWidth(true) : w;
//init default fonts
initDefaultFonts();
//init default button text font
ccf_btn_font = g_Font[SNeutrinoSettings::FONT_TYPE_BUTTON_TEXT];
//init footer height
initCaptionFont();
height = max(h, cch_font->getHeight());
@@ -88,7 +94,6 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const
corner_type = CORNER_BOTTOM;
ccf_enable_button_bg = false /*g_settings.theme.Button_gradient*/; //TODO: not implemented at the moment
ccf_btn_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT];
chain = NULL;
addContextButton(buttons);
@@ -426,3 +431,9 @@ void CComponentsFooter::enableButtonShadow(int mode, const int& shadow_width, bo
}
}
}
void CComponentsFooter::initDefaultFonts()
{
l_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE];
s_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT];
}