diff options
author | 2022-11-17 23:25:27 -0800 | |
---|---|---|
committer | 2022-11-18 08:25:27 +0100 | |
commit | 14fe203b96a2ebc57c53738a5264e4f3b509dd49 (patch) | |
tree | 39807b1e21f97ce711dad12c07a0b11408bf9674 /src/osd/osdsync.cpp | |
parent | 484758f5818c9bb77e150538023a3f6c93f3881b (diff) |
Ensure queue->thread will have at least 1 work_thread_info in it (#10560)
For platforms which do not support threads (i.e. emuscripten), queue->thread might not have any work_thread_info's added to it. This is bad as osd_work_item_queue_multiple will access queue->thread[0] when queue->threads == 0, and subsequently crash as the queue has no items in it.
Diffstat (limited to 'src/osd/osdsync.cpp')
-rw-r--r-- | src/osd/osdsync.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/osd/osdsync.cpp b/src/osd/osdsync.cpp index 6c6fec4dedf..3fa32f9141c 100644 --- a/src/osd/osdsync.cpp +++ b/src/osd/osdsync.cpp @@ -286,7 +286,7 @@ osd_work_queue *osd_work_queue_alloc(int flags) if (flags & WORK_QUEUE_FLAG_MULTI) allocthreadnum = queue->threads + 1; else - allocthreadnum = queue->threads; + allocthreadnum = std::max(queue->threads, 1u); #if KEEP_STATISTICS printf("osdprocs: %d effecprocs: %d threads: %d allocthreads: %d osdthreads: %d maxthreads: %d queuethreads: %d\n", osd_num_processors, numprocs, threadnum, allocthreadnum, osdthreadnum, WORK_MAX_THREADS, queue->threads); |