Skip to content

Commit e22a4fb

Browse files
Bug/androidcrash (#1447)
* Add java tests to build path to put the test in the appropriate directory, id have to java files to grade build configs, because it currently only checks for kotlin tests. * Unit test for rsrc leakage in unzip create a temp zip file > create a destination that is a file not a directory (guaranteed exception) -> unzip throws ioexception because it expects a directory not a file -> catch it -> check if the zip file is still open -> if true == leak. * Add try() to manage opened files/rsrcs * Applying try() to more rsrcs Ive also removed the test since its OS specific, and new code is supposed to be in kotlin. * conditional for setting decorated only when the frame is displayable * type * Applying dispose before frame is displayable Moved the undecorated setup to the very beginning of the Editor constructor before any operations that could make the frame displayable happened.
1 parent 779a8af commit e22a4fb

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,18 @@ public abstract class Editor extends JFrame implements RunnerListener {
148148
protected Editor(final Base base, String path, final EditorState state,
149149
final Mode mode) throws EditorException {
150150
super("Processing", state.getConfig());
151+
if (Platform.isLinux()) {
152+
// If the frame is already displayable, dispose it to allow undecorated change
153+
if (isDisplayable()) {
154+
dispose();
155+
}
156+
try {
157+
setUndecorated(true);
158+
} catch (IllegalComponentStateException e) {
159+
System.err.println("Could not set undecorated: " + e.getMessage());
160+
}
161+
getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
162+
}
151163
this.base = base;
152164
this.state = state;
153165
this.mode = mode;
@@ -211,10 +223,7 @@ public void windowDeactivated(WindowEvent e) {
211223
spacer.setAlignmentX(Component.LEFT_ALIGNMENT);
212224
box.add(spacer);
213225
}
214-
if (Platform.isLinux()) {
215-
setUndecorated(true);
216-
getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
217-
}
226+
218227

219228
rebuildModePopup();
220229
toolbar = createToolbar();

0 commit comments

Comments
 (0)