Program "crashes" when I setResizable(true) and resize the Window

Is this usable:

void setup() {
  size (320, 240);
  surface.setResizable(true);
  background(0);
}

void draw() {
  fill(255);
  rect(0,0,width,height);
  noLoop();
}