diff --git a/src/lib/openjp2/thread.c b/src/lib/openjp2/thread.c index 59b5d87e..fce563d0 100644 --- a/src/lib/openjp2/thread.c +++ b/src/lib/openjp2/thread.c @@ -930,7 +930,9 @@ void opj_thread_pool_destroy(opj_thread_pool_t* tp) int i; opj_thread_pool_wait_completion(tp, 0); + opj_mutex_lock(tp->mutex); tp->state = OPJWTS_STOP; + opj_mutex_unlock(tp->mutex); for(i=0;iworker_threads_count;i++) {