Skip to content
This repository
Browse code

don't allow a job with id 0 (will be used for invalid job id)

  • Loading branch information...
commit 1d985fcfa462134f7c2cf4a7a89a5a8e12da5b7c 1 parent c47e925
authored January 04, 2013

Showing 1 changed file with 6 additions and 1 deletion. Show diff stats Hide diff stats

  1. 7  xbmc/utils/JobManager.cpp
7  xbmc/utils/JobManager.cpp
@@ -203,8 +203,13 @@ unsigned int CJobManager::AddJob(CJob *job, IJobCallback *callback, CJob::PRIORI
203 203
 {
204 204
   CSingleLock lock(m_section);
205 205
 
  206
+  // increment the job counter, ensuring 0 (invalid job) is never hit
  207
+  m_jobCounter++;
  208
+  if (m_jobCounter == 0)
  209
+    m_jobCounter++;
  210
+
206 211
   // create a work item for this job
207  
-  CWorkItem work(job, m_jobCounter++, callback);
  212
+  CWorkItem work(job, m_jobCounter, callback);
208 213
   m_jobQueue[priority].push_back(work);
209 214
 
210 215
   StartWorkers(priority);

0 notes on commit 1d985fc

Please sign in to comment.
Something went wrong with that request. Please try again.