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.


Origin commit data
------------------
Commit: b98319cb91
Author: Thilo Graf <dbt@novatux.de>
Date: 2016-12-29 (Thu, 29 Dec 2016)
This commit is contained in:
2016-12-29 23:42:35 +01:00
parent 7072471b76
commit 476641a626
4 changed files with 26 additions and 4 deletions

View File

@@ -96,8 +96,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const
height = height_old = h;
cch_font = NULL;
l_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE];
s_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU];
initDefaultFonts();
cch_size_mode = CC_HEADER_SIZE_LARGE;
CNeutrinoApp::getInstance()->OnAfterSetupFonts.connect(sigc::mem_fun(this, &CComponentsHeader::resetFont));
@@ -167,9 +166,16 @@ void CComponentsHeader::setCaptionFont(Font* font)
void CComponentsHeader::resetFont()
{
if (cch_font){
cch_font = NULL;
dprintf(DEBUG_DEBUG, "\033[33m[CComponentsHeader][%s - %d] reset header font \033[0m\n", __func__, __LINE__);
cch_font = NULL;
}
initDefaultFonts();
}
void CComponentsHeader::initDefaultFonts()
{
l_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE];
s_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU];
}
void CComponentsHeader::initCaptionFont()