つかんではなさないの!

Surface surface = new Surface;
surface.load("nanika.jpg");
Texture texture = new Texture;
texture.setSurface(surface);   // これをするかしないかで
surface.getPixels;    // ピクセルデータの実体にアクセスできるか出来ないかが決まる

これできないと困っちゃうな。なんか回避策は無いものだろうか…。texture.release() しても意味なさげだし…。

private import y4d;
private import SDL;
private import std.stream;

void main() {
  Surface surface = new Surface;
  surface.load("images/bg_ship.jpg");
  Texture texture = new Texture;
  texture.setSurface(surface);    // これすると

  SDL_Surface* s = surface.getSurface;
  SDL_LockSurface(s);
  stdout.writeLine("no error");
  int pix = *(ubyte*)(s.pixels + 10*s.pitch + 10);   // ここでAV
  stdout.writeLine("no exec");
  SDL_UnlockSurface(s);
}