Permalink
Browse files

FIX: Crash when unloading fonts

  • Loading branch information...
1 parent 146bf53 commit 85934ef935aa6199c8c9d1e6a91901675bc9cd20 @koying committed Mar 4, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 xbmc/guilib/GUIFontManager.cpp
View
6 xbmc/guilib/GUIFontManager.cpp
@@ -239,13 +239,13 @@ void GUIFontManager::ReloadTTFFonts(void)
void GUIFontManager::UnloadTTFFonts()
{
+ for (vector<CGUIFont*>::iterator i = m_vecFonts.begin(); i != m_vecFonts.end(); i++)
+ (*i)->SetFont(NULL);
+
for (vector<CGUIFontTTFBase*>::iterator i = m_vecFontFiles.begin(); i != m_vecFontFiles.end(); i++)
delete (*i);
m_vecFontFiles.clear();
-
- for (vector<CGUIFont*>::iterator i = m_vecFonts.begin(); i != m_vecFonts.end(); i++)
- (*i)->SetFont(NULL);
}
void GUIFontManager::Unload(const CStdString& strFontName)

3 comments on commit 85934ef

@jmarshallnz

Fix is correct, though a crash is pointing to something using UI resources from two different threads.

@theuni

Yea, i assume this is happening when we hide the XBMC window? A backtrace would probably tell the whole story here if you can reproduce.

@koying
Owner

Sorry for the lack of details, I thought it would have been facepalm obvious to theUni ;-)

The (random) crash is in CGUIFontTTFBase::RemoveReference, called from CGUIFont::SetFont(NULL), indeed when hiding XBMC (e.g. going to the launcher).
Unless mistaken, the CGUIFontTTFBase's whose reference are removed are the same that are deleted just above, from m_vecFontFiles...

Please sign in to comment.