Skip to content

Commit 6745332

Browse files
committed
Fix freeze when restarting sketch with variables in size
While sketch is running, rewriting sketch size to variables and trying to restart the sketch by pressing the play button causes PDE to freeze. Fixed by moving AWT call to EDT.
1 parent 5391a00 commit 6745332

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

java/src/processing/mode/java/preproc/PdePreprocessor.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
package processing.mode.java.preproc;
2929

30+
import java.awt.*;
3031
import java.io.*;
3132
import java.util.*;
3233
import java.util.regex.MatchResult;
@@ -380,7 +381,9 @@ make sure that it uses numbers (or displayWidth/Height), copy into settings
380381
"The size of this sketch could not be determined from your code.\n" +
381382
"Use only numbers (not variables) for the size() command.\n" +
382383
"Read the size() reference for more details.";
383-
Messages.showWarning("Could not find sketch size", message, null);
384+
EventQueue.invokeLater(() -> {
385+
Messages.showWarning("Could not find sketch size", message, null);
386+
});
384387
// new Exception().printStackTrace(System.out);
385388
// return null;
386389
throw new SketchException("Please fix the size() line to continue.", false);

0 commit comments

Comments
 (0)