|
35 | 35 | import java.util.logging.Level; |
36 | 36 | import java.util.logging.Logger; |
37 | 37 |
|
| 38 | +import javax.swing.SwingUtilities; |
| 39 | + |
38 | 40 | import processing.app.*; |
39 | 41 | import processing.app.ui.Editor; |
40 | 42 | import processing.app.ui.EditorException; |
@@ -216,17 +218,27 @@ public void run() { |
216 | 218 | // } |
217 | 219 | // next lines are executed when the sketch quits |
218 | 220 | if (launchInteractive) { |
219 | | - editor.initEditorCode(parser.allHandles, false); |
220 | | - editor.stopTweakMode(parser.allHandles); |
| 221 | + // fix swing deadlock issue: https://github.com/processing/processing/issues/3928 |
| 222 | + SwingUtilities.invokeLater(new Runnable() { |
| 223 | + public void run() { |
| 224 | + editor.initEditorCode(parser.allHandles, false); |
| 225 | + editor.stopTweakMode(parser.allHandles); |
| 226 | + } |
| 227 | + }); |
221 | 228 | } |
222 | 229 | } |
223 | 230 | }).start(); |
224 | 231 |
|
225 | 232 | if (launchInteractive) { |
226 | | - // replace editor code with baseCode |
227 | | - editor.initEditorCode(parser.allHandles, false); |
228 | | - editor.updateInterface(parser.allHandles, parser.colorBoxes); |
229 | | - editor.startTweakMode(); |
| 233 | + // fix swing deadlock issue: https://github.com/processing/processing/issues/3928 |
| 234 | + SwingUtilities.invokeLater(new Runnable() { |
| 235 | + public void run() { |
| 236 | + // replace editor code with baseCode |
| 237 | + editor.initEditorCode(parser.allHandles, false); |
| 238 | + editor.updateInterface(parser.allHandles, parser.colorBoxes); |
| 239 | + editor.startTweakMode(); |
| 240 | + } |
| 241 | + }); |
230 | 242 | } |
231 | 243 | return runtime; |
232 | 244 | } |
|
0 commit comments