Skip to content

Commit b2fb784

Browse files
committed
Fix memory leak in Recent
Recent menu was keeping Editors in memory
1 parent 6b1578d commit b2fb784

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

app/src/processing/app/ui/Recent.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -351,12 +351,6 @@ static class Record {
351351
String path; // if not loaded, this is non-null
352352
// EditorState state; // if not loaded, this is non-null
353353

354-
/**
355-
* If currently loaded, this is non-null, and takes precedence over the
356-
* path and state information, which will instead be stored actively by
357-
* the actual sketch object.
358-
*/
359-
Editor editor;
360354
// Sketch sketch;
361355

362356
// Record(String path, EditorState state) {
@@ -374,14 +368,10 @@ static class Record {
374368
// }
375369

376370
Record(Editor editor) {
377-
this.editor = editor;
378-
this.path = editor.getSketch().getMainFilePath();
371+
this(editor.getSketch().getMainFilePath());
379372
}
380373

381374
String getName() {
382-
if (editor != null) {
383-
return editor.getSketch().getName();
384-
}
385375
// Get the filename of the .pde (or .js or .py...)
386376
String name = path.substring(path.lastIndexOf(File.separatorChar) + 1);
387377
// Return the name with the extension removed

0 commit comments

Comments
 (0)