Fixed corrupted white theme when DefaultTheme was initialized before Color constants

0.8
Bruno Van de Velde 2019-02-18 19:54:54 +01:00
parent 139330f4bb
commit f992bc5537
2 changed files with 11 additions and 13 deletions

View File

@ -7,6 +7,7 @@ TGUI 0.8.4 (TBD)
- Added option to ListView to expand the last column to fill the remaining space
- Allow a separator between the header and contents in a ListView
- Split separator in ListView into separator and vertical grid line
- Fixed corrupted white theme when DefaultTheme was initialized before Color constants
TGUI 0.8.3 (27 January 2019)

View File

@ -35,7 +35,7 @@ namespace tgui
{
struct DefaultTheme : public Theme
{
DefaultTheme()
void reset()
{
m_renderers = {
{"button", RendererData::create({{"borders", Borders{1}},
@ -250,15 +250,11 @@ namespace tgui
};
}
};
DefaultTheme defaultTheme;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Theme* Theme::m_defaultTheme = &defaultTheme;
Theme* Theme::m_defaultTheme = nullptr;
std::shared_ptr<BaseThemeLoader> Theme::m_themeLoader = std::make_shared<DefaultThemeLoader>();
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -434,19 +430,20 @@ namespace tgui
void Theme::setDefault(Theme* theme)
{
if (theme)
m_defaultTheme = theme;
else
{
defaultTheme = {};
m_defaultTheme = &defaultTheme;
}
m_defaultTheme = theme;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Theme* Theme::getDefault()
{
if (!m_defaultTheme)
{
static DefaultTheme defaultTheme;
defaultTheme.reset();
m_defaultTheme = &defaultTheme;
}
return m_defaultTheme;
}