diff --git a/factor/jedit/FactorShell.java b/factor/jedit/FactorShell.java index 1968ba18f0..4a22ed9a20 100644 --- a/factor/jedit/FactorShell.java +++ b/factor/jedit/FactorShell.java @@ -34,7 +34,7 @@ import factor.*; import javax.swing.text.AttributeSet; import java.io.IOException; import java.util.Iterator; -import java.util.WeakHashMap; +import java.util.HashMap; import org.gjt.sp.jedit.jEdit; import org.gjt.sp.jedit.ServiceManager; import org.gjt.sp.util.Log; @@ -45,7 +45,19 @@ public class FactorShell extends Shell public FactorShell() { super("Factor"); - consoles = new WeakHashMap(); + consoles = new HashMap(); + } //}}} + + //{{{ closeConsole() method + /** + * Called when a Console dockable is closed. + * @since Console 4.0.2 + */ + public void closeConsole(Console console) + { + ConsoleState state = (ConsoleState)consoles.get(console); + if(state != null) + state.closeStream(); } //}}} //{{{ printInfoMessage() method @@ -129,7 +141,7 @@ public class FactorShell extends Shell } //}}} //{{{ Private members - private WeakHashMap consoles; + private HashMap consoles; //{{{ getConsoleState() method private ConsoleState getConsoleState(Console console) @@ -178,7 +190,6 @@ public class FactorShell extends Shell console.print(console.getInfoColor(), jEdit.getProperty("factor.shell.closing")); stream.close(); - stream = null; } } catch(IOException e) @@ -186,6 +197,8 @@ public class FactorShell extends Shell /* We don't care */ Log.log(Log.ERROR,this,e); } + + stream = null; } void packetLoop(Output output) throws Exception diff --git a/library/tools/debugger.factor b/library/tools/debugger.factor index 3b5eda2a92..46ad510af7 100644 --- a/library/tools/debugger.factor +++ b/library/tools/debugger.factor @@ -59,19 +59,20 @@ USE: unparser #! The game overrides this. ; +: :s ( -- ) "error-datastack" get {.} ; +: :r ( -- ) "error-callstack" get {.} ; +: :n ( -- ) "error-namestack" get {.} ; +: :c ( -- ) "error-catchstack" get {.} ; + : default-error-handler ( error -- ) #! Print the error and return to the top level. [ in-parser? [ parse-dump ] [ standard-dump ] ifte - ":s :r :n :c show stacks at time of error." print + [ :s :r :n :c ] [ prettyprint-word " " write ] each + "show stacks at time of error." print java? [ ":j shows Java stack trace." print ] when error-handler-hook ] when* ; - -: :s ( -- ) "error-datastack" get {.} ; -: :r ( -- ) "error-callstack" get {.} ; -: :n ( -- ) "error-namestack" get {.} ; -: :c ( -- ) "error-catchstack" get {.} ;