On 11/3/11, Andrej Mitrovic <[email protected]> wrote:
> Unhandled Exception: EXCEPTION_ACCESS_VIOLATION(0xc0000005) at
> CORE_RL_magick_.dll (0x100c1267) thread(3440)

I think I've found the issue:

void[] pixels = new T[area.width*area.height];

Here you're allocating width*height, but you didn't take into account
that each exported channel specified by map will need more
width*height storage. Here's what I did to fix it:

import std.utf;
auto pixels = new T[]((area.width * area.height) * map.count);
// call ExportImagePixels
return pixels;

I think the DLL tried to write to memory beyond what the GC allocated
for the array, and hence the access violation.

Reply via email to