Fix in BackrgoundSourceProcessingService:
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 25 Feb 2014 21:04:27 +0100
changeset 14053 08f7da1dd758
parent 14052 ebcdddd89b02
child 14054 1931f75c8318
Fix in BackrgoundSourceProcessingService: When codeview is used in debugger and an error/halt/breakpoint occur, catch the error and only print a backtrace onto a Transcript. This avoids a *debugger bomb* when there's some error source highlighter or other source processing service.
Tools__BackgroundSourceProcessingService.st
--- a/Tools__BackgroundSourceProcessingService.st	Tue Feb 25 21:03:46 2014 +0100
+++ b/Tools__BackgroundSourceProcessingService.st	Tue Feb 25 21:04:27 2014 +0100
@@ -165,20 +165,11 @@
 initialize
     job := (Smalltalk at:#BackgroundJob) 
                 named:self defaultJobName
-                on:[
-                    Error handle:[:ex |
-                        (Dialog confirm:('Error while processing source:\\',ex description,'\\Debug ?') withCRs)
-                        ifTrue:[
-                            ex reject.
-                        ]
-                    ] do:[
-                        self process:true
-                    ]
-                ].
+                on:[self processSafely: true]
 
     "Created: / 29-07-2011 / 10:31:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 24-01-2012 / 12:26:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 19-07-2012 / 16:17:21 / cg"
+    "Modified: / 25-02-2014 / 19:58:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !BackgroundSourceProcessingService methodsFor:'processing'!
@@ -214,13 +205,40 @@
 !
 
 process: delayed
-    "Do the real source processing. If delayed is true, actuall data update must
-     be done within the event queue using #pushUserEvent:...
+    "Actually process source code. If `delayed` is true, view should be updated
+     asynchronously using #pushUserEvent:. Individual services should override
+     this method.
+
+     NOTE: Do not call this method from custom code directly, always call
+     #processSafely: which handle possible errors and protect against
+     'debugger bomb'
      "
 
     self subclassResponsibility
 
     "Created: / 24-01-2012 / 12:25:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (comment): / 25-02-2014 / 19:52:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+processSafely: delayed
+    "Process source code. If `delayed` is true, view should be updated
+     asynchronously using #pushUserEvent:"
+
+    Exception , HaltInterrupt handle:[:ex|
+        "/ Kludge...    
+        (codeView topView class == DebugView) ifTrue:[
+            Transcript showCR: 'Error when processing source code'.
+            ex suspendedContext fullPrintAllOn: Transcript.
+        ] ifFalse:[
+            (Dialog confirm:('Error while processing source:\\',ex description,'\\Debug ?') withCRs) ifTrue:[
+                ex reject.
+            ]
+        ]
+    ] do:[
+        self process: delayed
+    ]
+
+    "Created: / 25-02-2014 / 19:57:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !BackgroundSourceProcessingService methodsFor:'registering'!
@@ -236,10 +254,10 @@
 !BackgroundSourceProcessingService class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__BackgroundSourceProcessingService.st,v 1.4 2014-02-05 19:09:08 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__BackgroundSourceProcessingService.st,v 1.5 2014-02-25 20:04:27 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__BackgroundSourceProcessingService.st,v 1.4 2014-02-05 19:09:08 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__BackgroundSourceProcessingService.st,v 1.5 2014-02-25 20:04:27 vrany Exp $'
 ! !