Skip to content

Commit 51add87

Browse files
committed
fixes for Python Mode crashing on startup
1 parent 532e90a commit 51add87

4 files changed

Lines changed: 27 additions & 10 deletions

File tree

app/src/processing/app/syntax/PdeInputHandler.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,19 @@ public class PdeInputHandler extends DefaultInputHandler {
4848
protected Editor editor;
4949

5050

51-
/** Not recommended, but included for compatibility. */
52-
public PdeInputHandler() { }
53-
54-
51+
/**
52+
* Recommended constructor.
53+
* @since 3.2
54+
*/
5555
public PdeInputHandler(Editor editor) {
5656
this.editor = editor;
57+
}
58+
5759

60+
/**
61+
* Not recommended, but included for API compatibility.
62+
*/
63+
public PdeInputHandler() {
5864
// Use option on mac for text edit controls that are ctrl on Windows/Linux.
5965
// (i.e. ctrl-left/right is option-left/right on OS X)
6066
String mod = Platform.isMacOS() ? "A" : "C";

app/src/processing/app/ui/Editor.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,10 @@ public void caretUpdate(CaretEvent e) {
296296
upper.add(editorPanel);
297297

298298
// set colors and fonts for the painter object
299-
getPdeTextArea().setMode(mode);
299+
PdeTextArea pta = getPdeTextArea();
300+
if (pta != null) {
301+
pta.setMode(mode);
302+
}
300303

301304
splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, upper, footer);
302305

@@ -1594,7 +1597,7 @@ public JEditTextArea getTextArea() {
15941597

15951598

15961599
public PdeTextArea getPdeTextArea() {
1597-
return (PdeTextArea) textarea;
1600+
return (textarea instanceof PdeTextArea) ? (PdeTextArea) textarea : null;
15981601
}
15991602

16001603

app/src/processing/app/ui/MarkerColumn.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import processing.app.Problem;
3838
import processing.app.Sketch;
3939
import processing.app.SketchCode;
40+
import processing.app.syntax.PdeTextArea;
4041
import processing.app.ui.Editor;
4142
import processing.core.PApplet;
4243

@@ -92,8 +93,11 @@ public void repaint() {
9293

9394
@Override
9495
public void paintComponent(Graphics g) {
95-
g.drawImage(editor.getPdeTextArea().getGutterGradient(),
96-
0, 0, getWidth(), getHeight(), this);
96+
PdeTextArea pta = editor.getPdeTextArea();
97+
if (pta != null) {
98+
g.drawImage(pta.getGutterGradient(),
99+
0, 0, getWidth(), getHeight(), this);
100+
}
97101

98102
int currentTabIndex = editor.getSketch().getCurrentCodeIndex();
99103

todo.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
0253 (3.2.1)
22
X “Could not replace preferences.old” error message
33
X https://github.com/processing/processing/issues/4626
4-
o 3.2 not starting up on Windows 10 (64-bit)
4+
_ Version 3.2 won't run from paths with spaces on Windows
55
X https://github.com/processing/processing/issues/4623
6-
o can't reproduce; might be #4626?
6+
_ might be ext.dirs trouble with spaces in path names?
7+
_ or the backwards slashes?
8+
X fixes for Python Mode crashing on startup
79

10+
_ library compilations handled oddly
11+
_ https://github.com/processing/processing/issues/4630
812

913
_ update launch4j to 3.9
1014
_ https://sourceforge.net/projects/launch4j/files/launch4j-3/3.9/

0 commit comments

Comments
 (0)