possibly cancel out-of-control Timer

This commit is contained in:
Ben Fry
2015-08-19 16:30:03 -04:00
parent 78ce2b2a52
commit 135b6828ee

View File

@@ -153,7 +153,6 @@ public abstract class Editor extends JFrame implements RunnerListener {
Image backgroundGradient;
// protected Editor(final Base base, String path, int[] location, final Mode mode) {
protected Editor(final Base base, String path, final EditorState state,
final Mode mode) throws EditorException {
super("Processing", state.checkConfig());
@@ -2026,6 +2025,7 @@ public abstract class Editor extends JFrame implements RunnerListener {
return endUndoEvent != null;
}
void startTimerEvent() {
endUndoEvent = new TimerTask() {
public void run() {
@@ -2037,6 +2037,7 @@ public abstract class Editor extends JFrame implements RunnerListener {
timer.purge();
}
void endTextEditHistory() {
if (endUndoEvent != null) {
endUndoEvent.cancel();
@@ -2045,6 +2046,13 @@ public abstract class Editor extends JFrame implements RunnerListener {
stopCompoundEdit();
}
public void removeNotify() {
timer.cancel();
super.removeNotify();
}
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .