Skip to content

Commit

Permalink
Merge pull request #15310 from linknetx/active-skin-update
Browse files Browse the repository at this point in the history
Active Skin Update - Force Close TextureBundle
  • Loading branch information
MartijnKaijser committed Jan 26, 2019
2 parents ed443c9 + f1ce615 commit f4aef1c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions xbmc/addons/Skin.cpp
Expand Up @@ -392,6 +392,9 @@ const INFO::CSkinVariableString* CSkinInfo::CreateSkinVariable(const std::string

void CSkinInfo::OnPreInstall()
{
bool skinLoaded = g_SkinInfo != nullptr;
if (IsInUse() && skinLoaded)
CApplicationMessenger::GetInstance().SendMsg(TMSG_EXECUTE_BUILT_IN, -1, -1, nullptr, "UnloadSkin");
}

void CSkinInfo::OnPostInstall(bool update, bool modal)
Expand Down
5 changes: 5 additions & 0 deletions xbmc/guilib/TextureBundle.cpp
Expand Up @@ -66,6 +66,11 @@ int CTextureBundle::LoadAnim(const std::string& Filename, CBaseTexture*** ppText
return 0;
}

void CTextureBundle::Close()
{
m_tbXBT.CloseBundle();
}

void CTextureBundle::SetThemeBundle(bool themeBundle)
{
m_tbXBT.SetThemeBundle(themeBundle);
Expand Down
2 changes: 1 addition & 1 deletion xbmc/guilib/TextureBundle.h
Expand Up @@ -27,7 +27,7 @@ class CTextureBundle
bool LoadTexture(const std::string& Filename, CBaseTexture** ppTexture, int &width, int &height);

int LoadAnim(const std::string& Filename, CBaseTexture*** ppTextures, int &width, int &height, int& nLoops, int** ppDelays);

void Close();
private:
CTextureBundleXBT m_tbXBT;

Expand Down
5 changes: 5 additions & 0 deletions xbmc/guilib/TextureBundleXBT.cpp
Expand Up @@ -45,6 +45,11 @@ CTextureBundleXBT::CTextureBundleXBT(bool themeBundle)
}

CTextureBundleXBT::~CTextureBundleXBT(void)
{
CloseBundle();
}

void CTextureBundleXBT::CloseBundle()
{
if (m_XBTFReader != nullptr && m_XBTFReader->IsOpen())
{
Expand Down
2 changes: 2 additions & 0 deletions xbmc/guilib/TextureBundleXBT.h
Expand Up @@ -37,6 +37,8 @@ class CTextureBundleXBT
int &width, int &height, int& nLoops, int** ppDelays);

static uint8_t* UnpackFrame(const CXBTFReader& reader, const CXBTFFrame& frame);

void CloseBundle();

private:
bool OpenBundle();
Expand Down
3 changes: 2 additions & 1 deletion xbmc/guilib/TextureManager.cpp
Expand Up @@ -533,7 +533,8 @@ void CGUITextureManager::Cleanup()
delete pMap;
i = m_vecTextures.erase(i);
}

m_TexBundle[0].Close();
m_TexBundle[1].Close();
m_TexBundle[0] = CTextureBundle(true);
m_TexBundle[1] = CTextureBundle();
FreeUnusedTextures();
Expand Down

0 comments on commit f4aef1c

Please sign in to comment.