From: Jonathan Marshall Date: Thu, 3 Jan 2013 20:25:34 +0000 (+1300) Subject: don't allow a job with id 0 (will be used for invalid job id) X-Git-Tag: 12.0-Frodo~98 X-Git-Url: http://code.vuplus.com/gitweb/?a=commitdiff_plain;h=a9f97d1a55c5a31a959becc1a584259c33b9f640;p=vuplus_xbmc don't allow a job with id 0 (will be used for invalid job id) --- diff --git a/xbmc/utils/JobManager.cpp b/xbmc/utils/JobManager.cpp index bebf80b..d3b3be1 100644 --- a/xbmc/utils/JobManager.cpp +++ b/xbmc/utils/JobManager.cpp @@ -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);