From 1e4c557d82b005578dd2b361701241b66ccee42f Mon Sep 17 00:00:00 2001 From: Colin Basnett Date: Sat, 16 Jul 2022 20:57:28 +0200 Subject: Fix T99039: bpy.ops.sound.mixdown returns indecipherable error Fix for {T99039}. The problem was that `AUD_mixdown` and `AUD_mixdown_per_channel` were returning pointers to freed memory. Two key changes are made: 1. The return value of those functions now simply return a bool as to whether the operation succeeded, instead of an optional error string pointer. 2. The error string buffer is now passed into the function to be filled in case an error occurs. In this way, the onus of memory ownership is unamibiguously on the caller. Differential Revision: https://developer.blender.org/D15260 --- source/blender/editors/sound/sound_ops.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'source/blender/editors/sound/sound_ops.c') diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 2a8a2be8b65..08b795db0c3 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -340,7 +340,8 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op) AUD_DeviceSpecs specs; AUD_Container container; AUD_Codec codec; - const char *result; + int result; + char error_message[1024] = {'\0'}; sound_bake_animation_exec(C, op); @@ -372,7 +373,9 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op) codec, bitrate, NULL, - NULL); + NULL, + error_message, + sizeof(error_message)); } else { result = AUD_mixdown(scene_eval->sound_scene, @@ -385,13 +388,15 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op) codec, bitrate, NULL, - NULL); + NULL, + error_message, + sizeof(error_message)); } BKE_sound_reset_scene_specs(scene_eval); - if (result) { - BKE_report(op->reports, RPT_ERROR, result); + if (!result) { + BKE_report(op->reports, RPT_ERROR, error_message); return OPERATOR_CANCELLED; } #else /* WITH_AUDASPACE */ -- cgit v1.2.3