# HG changeset patch # User reimar # Date 1258751306 0 # Node ID e68792a12c3187827a4ef1e0c2f41f2c7b7cb287 # Parent 8a2d04d5deb9408c8355dca68833a04be48ff1b8 In win32 thread implementation do not access jobnr if the thread is asked to terminate, jobnr it does not point to a valid location in that case. diff -r 8a2d04d5deb9 -r e68792a12c31 w32thread.c --- a/w32thread.c Fri Nov 20 19:16:42 2009 +0000 +++ b/w32thread.c Fri Nov 20 21:08:26 2009 +0000 @@ -48,16 +48,17 @@ int ret, jobnr; //printf("thread_func %X enter wait\n", (int)v); fflush(stdout); WaitForSingleObject(c->work_sem, INFINITE); + // avoid trying to access jobnr if we should quit + if (!c->func && !c->func2) + break; WaitForSingleObject(c->job_sem, INFINITE); jobnr = (*c->jobnr)++; ReleaseSemaphore(c->job_sem, 1, 0); //printf("thread_func %X after wait (func=%X)\n", (int)v, (int)c->func); fflush(stdout); if(c->func) ret= c->func(c->avctx, (uint8_t *)c->arg + jobnr*c->argsize); - else if (c->func2) + else ret= c->func2(c->avctx, c->arg, jobnr, c->threadnr); - else - return 0; if (c->ret) c->ret[jobnr] = ret; //printf("thread_func %X signal complete\n", (int)v); fflush(stdout);