Sketch soft crashes when resizing window

I was trying to play around with the new windowResizable() and other related functions added in processing 4. however I found that sometimes after resizing the window the sketch would stop redrawing, mouse click also didn’t work. The window didn’t close and I could keep resizing it however the new window space that was created was just black. I created another thread and that didn’t get stopped when the sketch froze and was able to detect when the main thread stopped executing.

code that I was testing

void setup(){
  size(400,400);
  windowResizable(true);
  thread("nt");
}

int lt=0;
void draw(){
  background(100);
  println(width+" "+height+" "+frameCount);
  fill(random(-16777215,0));
  rect(width/2,height/2,100,100);
  lt=millis();
}

void windowResized(){
  println("window resized");
}

void windowMoved(){
  println("window moved");
}

void mouseClicked(){
  println("peepee poopoo");
}

void nt(){
 while(true){
   random(1);
   if(millis()-lt>100){
     println("wee woo");
   }
 }
}

does anyone know why this might be happening?

1 Like

Hello @jSdCool,

Related topic:

:)

that is not the issue that I am having here
effect
the issue is not that it flickers it is that the image stops updating entirely

Hello @jSdCool,

I shared a related topic and the solution that solved the flicker solved the issue here.

W10 and Processing 4.01 tested.

:)

I tried adding delay to my sketch and it did not fix the problem
I don’t know why it would solve the problem when the problem is that the sketch stop executing entirely after the window is resized.
additionally the window is not resized from inside the sketch but by the user at any point.

where exactly did you change things to fix it?