Skip to content

Commit 21c91a7

Browse files
committed
Avoid firing watcher if it failed to start proviously
In case of low inotify watch level, simply avoid doing anything. Backing storage will be uncorrelated with the sketch content (as before) TODO: maybe add a notification about this event
1 parent f010ffb commit 21c91a7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/src/processing/app/Editor.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public class Editor extends JFrame implements RunnerListener, FocusListener {
9696
private final Box upper;
9797
private ArrayList<EditorTab> tabs = new ArrayList<>();
9898
private int currentTabIndex = -1;
99+
private static boolean watcherDisable = false;
99100

100101
private static class ShouldSaveIfModified
101102
implements Predicate<SketchController> {
@@ -1989,6 +1990,10 @@ protected boolean handleOpenInternal(File sketchFile) {
19891990
// Disable untitled setting from previous document, if any
19901991
untitled = false;
19911992

1993+
if (watcherDisable == true) {
1994+
return true;
1995+
}
1996+
19921997
// Add FS watcher for current Editor instance
19931998
Path dir = file.toPath().getParent();
19941999

@@ -1999,7 +2004,7 @@ public void run() {
19992004
try {
20002005
new WatchDir(dir, true).processEvents(instance);
20012006
} catch (IOException x) {
2002-
System.err.println(x);
2007+
watcherDisable = true;
20032008
}
20042009
}
20052010
};

0 commit comments

Comments
 (0)