class: Tools::BreakpointService
authorClaus Gittinger <cg@exept.de>
Fri, 21 Jun 2013 09:53:28 +0200
changeset 12969 3642a54942f0
parent 12968 34c2e89020d5
child 12970 012386ca74e2
class: Tools::BreakpointService changed: #breakpointAtLine: #recompile #setOrToggleBreakpointAtLine:
Tools__BreakpointService.st
--- a/Tools__BreakpointService.st	Fri Jun 21 09:52:23 2013 +0200
+++ b/Tools__BreakpointService.st	Fri Jun 21 09:53:28 2013 +0200
@@ -184,8 +184,10 @@
 breakpointAtLine:line
     |pos|
 
+    breakpoints isNil ifTrue:[^ nil].
+
     pos := textView characterPositionOfLine:line col:1.
-    ^ breakpoints ? #() detect:[:each | each position = pos ] ifNone:[ nil ]
+    ^ breakpoints detect:[:each | each position = pos ] ifNone:[ nil ]
 
     "Modified: / 17-06-2011 / 13:59:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified (format): / 05-07-2011 / 21:33:23 / cg"
@@ -272,7 +274,17 @@
                         ^ self
                     ].
                 ].
-                "/ must come indirectly!!
+
+                breakpoints := breakpoints
+                                select:[:bp |
+"/                                    bp isReached ifFalse:[ 
+"/                                        "/ Transcript show:'remove unreached:'; showCR:bp 
+"/                                    ].
+                                    bp isReached
+                                ].
+
+                "/ must update breakpoints BEFORE the following, because it leads to a change
+                "/ notification, which may clear the breakpoints collection!!
                 codeView methodHolder value:newMethod.
                 oldMethod mclass isNil ifTrue:[
                     "/ although this is not strictly true, not doing this
@@ -282,14 +294,6 @@
                 class changed:#methodTrap with:selector. "/ tell browsers
                 Smalltalk changed:#methodTrap with:(MethodTrapChangeNotificationParameter changeClass:class changeSelector:selector).
             ].
-
-            breakpoints := breakpoints
-                            select:[:bp |
-"/                                bp isReached ifFalse:[ 
-"/                                    "/ Transcript show:'remove unreached:'; showCR:bp 
-"/                                ].
-                                bp isReached
-                            ]
         ]
     ]
 
@@ -348,6 +352,7 @@
                 "/ trace
                 bpnt beTracepoint
             ].
+            self assert: breakpoints notEmptyOrNil.
             self recompile.
         ] ifFalse:[
             codeView topView class == DebugView ifTrue:[
@@ -463,14 +468,14 @@
 !BreakpointService class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.23 2013-06-20 23:21:35 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.24 2013-06-21 07:53:28 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.23 2013-06-20 23:21:35 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.24 2013-06-21 07:53:28 cg Exp $'
 !
 
 version_SVN
-    ^ '$Id: Tools__BreakpointService.st,v 1.23 2013-06-20 23:21:35 cg Exp $'
+    ^ '$Id: Tools__BreakpointService.st,v 1.24 2013-06-21 07:53:28 cg Exp $'
 ! !