Skip to content

Commit

Permalink
don't allow a job with id 0 (will be used for invalid job id)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Marshall committed Jan 3, 2013
1 parent c47e925 commit 1d985fc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion xbmc/utils/JobManager.cpp
Expand Up @@ -203,8 +203,13 @@ unsigned int CJobManager::AddJob(CJob *job, IJobCallback *callback, CJob::PRIORI
{
CSingleLock lock(m_section);

// increment the job counter, ensuring 0 (invalid job) is never hit
m_jobCounter++;
if (m_jobCounter == 0)
m_jobCounter++;

// create a work item for this job
CWorkItem work(job, m_jobCounter++, callback);
CWorkItem work(job, m_jobCounter, callback);
m_jobQueue[priority].push_back(work);

StartWorkers(priority);
Expand Down

0 comments on commit 1d985fc

Please sign in to comment.