Skip to content

Commit

Permalink
ensure we remove cache jobs from our processing queue regardless of w…
Browse files Browse the repository at this point in the history
…hether they were successful
  • Loading branch information
Jonathan Marshall committed May 5, 2012
1 parent fb90415 commit 55b4038
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions xbmc/TextureCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,16 @@ CStdString CTextureCache::GetCachedPath(const CStdString &file)

void CTextureCache::OnJobComplete(unsigned int jobID, bool success, CJob *job)
{
if (strcmp(job->GetType(), "cacheimage") == 0 && success)
if (strcmp(job->GetType(), "cacheimage") == 0)
{
CTextureCacheJob *cacheJob = (CTextureCacheJob *)job;
if (cacheJob->m_oldHash == cacheJob->m_details.hash)
SetCachedTextureValid(cacheJob->m_url, cacheJob->m_details.updateable);
else
AddCachedTexture(cacheJob->m_url, cacheJob->m_details);
if (success)
{
if (cacheJob->m_oldHash == cacheJob->m_details.hash)
SetCachedTextureValid(cacheJob->m_url, cacheJob->m_details.updateable);
else
AddCachedTexture(cacheJob->m_url, cacheJob->m_details);
}

{ // remove from our processing list
CSingleLock lock(m_processingSection);
Expand All @@ -307,7 +310,7 @@ void CTextureCache::OnJobComplete(unsigned int jobID, bool success, CJob *job)
m_completeEvent.Set();

// TODO: call back to the UI indicating that it can update it's image...
if (g_advancedSettings.m_useDDSFanart && !cacheJob->m_details.file.empty())
if (success && g_advancedSettings.m_useDDSFanart && !cacheJob->m_details.file.empty())
AddJob(new CTextureDDSJob(GetCachedPath(cacheJob->m_details.file)));
}
return CJobQueue::OnJobComplete(jobID, success, job);
Expand Down

0 comments on commit 55b4038

Please sign in to comment.