[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1082749: Patch



The bug appears to be caused by a compiler optimisation. Disabling compiler optimisations in the Makefile fixes the bug, but isn't an optimal solution. Moving the declaration of `schedule_feature` out of the `if` block is a workaround that prevents the compiler from reusing the memory.

Patch attached.

Cheers,
Michael
diff --git a/lv2file.c b/lv2file.c
index b30dd76..009e236 100644
--- a/lv2file.c
+++ b/lv2file.c
@@ -771,13 +771,14 @@ if(!clipped && clipOutput (numread * numout, sndfilebuffer)) {
 				features[2] = &options_feature;
 
 				LV2_Worker_Schedule* schedule = NULL;
+				LV2_Feature schedule_feature = { LV2_WORKER__schedule, NULL };
 				if (has_worker) {
 					schedule                = (LV2_Worker_Schedule*)malloc (sizeof (LV2_Worker_Schedule));
 					schedule->handle        = NULL;
 					schedule->schedule_work = lv2_worker_schedule;
 
-					const LV2_Feature schedule_feature = { LV2_WORKER__schedule, schedule };
-					features[n_features++]             = &schedule_feature;
+					schedule_feature.data  = schedule;
+					features[n_features++] = &schedule_feature;
 				}
 
 				features[n_features] = NULL;

Reply to: