www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - double free or corruption error when using parallel foreach

I want to make my raytracer run in parallel to speed things up.

I have this code:

http://pastebin.com/a2Aw1LnX

And I get this:

Rendering...
*** glibc detected *** 
/home/minas/Projects/D/raytracing/raytracing/bin/Release/raytracing: 
double free or corruption (fasttop): 0x0000000001681710 ***
*** glibc detected *** 
/home/minas/Projects/D/raytracing/raytracing/bin/Release/raytracing: 
double free or corruption (fasttop): 0x0000000001681710 ***
bash: line 1: 27493 Aborted                 (core dumped) 
/home/minas/Projects/D/raytracing/raytracing/bin/Release/raytracing

Why does this happen?

Note that scene is of type Scene, which is a struct.
Dec 27 2012