mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
fix assertion failure upon loading invalid sound path due to extra ma_fence_release
In ma_resource_manager_data_buffer_node_acquire_critical_section, a job which releases already acquired fences is either processed or posted based on MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_WAIT_INIT. However on job post or process failure, the fences were being unconditionally released. This commit moves the fence releases in acquire_critical_section down into a nested branch which only executes if MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_WAIT_INIT is not set, causing the fence release to take place only if the job failed to post while relying on the job itself to release the fences if it processes rather than causing a duplicate ma_fence_release and thus an eventual assertion failure.
This commit is contained in:
+3
-3
@@ -70408,6 +70408,9 @@ static ma_result ma_resource_manager_data_buffer_node_acquire_critical_section(m
|
|||||||
/* Failed to post job. Probably ran out of memory. */
|
/* Failed to post job. Probably ran out of memory. */
|
||||||
ma_log_postf(ma_resource_manager_get_log(pResourceManager), MA_LOG_LEVEL_ERROR, "Failed to post MA_JOB_TYPE_RESOURCE_MANAGER_LOAD_DATA_BUFFER_NODE job. %s.\n", ma_result_description(result));
|
ma_log_postf(ma_resource_manager_get_log(pResourceManager), MA_LOG_LEVEL_ERROR, "Failed to post MA_JOB_TYPE_RESOURCE_MANAGER_LOAD_DATA_BUFFER_NODE job. %s.\n", ma_result_description(result));
|
||||||
|
|
||||||
|
if ((flags & MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_WAIT_INIT) != 0) {
|
||||||
|
ma_resource_manager_inline_notification_uninit(pInitNotification);
|
||||||
|
} else {
|
||||||
/*
|
/*
|
||||||
Fences were acquired before posting the job, but since the job was not able to
|
Fences were acquired before posting the job, but since the job was not able to
|
||||||
be posted, we need to make sure we release them so nothing gets stuck waiting.
|
be posted, we need to make sure we release them so nothing gets stuck waiting.
|
||||||
@@ -70415,9 +70418,6 @@ static ma_result ma_resource_manager_data_buffer_node_acquire_critical_section(m
|
|||||||
if (pInitFence != NULL) { ma_fence_release(pInitFence); }
|
if (pInitFence != NULL) { ma_fence_release(pInitFence); }
|
||||||
if (pDoneFence != NULL) { ma_fence_release(pDoneFence); }
|
if (pDoneFence != NULL) { ma_fence_release(pDoneFence); }
|
||||||
|
|
||||||
if ((flags & MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_WAIT_INIT) != 0) {
|
|
||||||
ma_resource_manager_inline_notification_uninit(pInitNotification);
|
|
||||||
} else {
|
|
||||||
/* These will have been freed by the job thread, but with WAIT_INIT they will already have happened since the job has already been handled. */
|
/* These will have been freed by the job thread, but with WAIT_INIT they will already have happened since the job has already been handled. */
|
||||||
ma_free(pFilePathCopy, &pResourceManager->config.allocationCallbacks);
|
ma_free(pFilePathCopy, &pResourceManager->config.allocationCallbacks);
|
||||||
ma_free(pFilePathWCopy, &pResourceManager->config.allocationCallbacks);
|
ma_free(pFilePathWCopy, &pResourceManager->config.allocationCallbacks);
|
||||||
|
|||||||
Reference in New Issue
Block a user