Skip to content

Commit

Permalink
debugger answer method now loops safely / fixed process selection bug
Browse files Browse the repository at this point in the history
#927

No need to send `loopWhile:` in JadeiteDebugger>>answer.

When selecting processes, make sure the process list in the gui is checked before making the selection. And use an `at:ifAbsent:`

Also, while waiting for an answer, if the loop is terminated, double check that the deferred value is available and return that if so.
  • Loading branch information
Eric Winger authored and Eric Winger committed Oct 13, 2022
1 parent b9eff86 commit 067f899
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions sources/JadePresenter.cls
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ waitForAnswer: thingThatCanAnswer
[loop isAlive] whileTrue:
[thingThatCanAnswer isDeafObject
ifTrue:
[loop terminate. "uncerimoneously kill the loop - don't run ensure blocks"
^nil].
[loop terminate.
^deferredValue hasValue ifTrue: [deferredValue value] ifFalse: [nil]].
(Delay forMilliseconds: 1) wait]].
theAnswer := [deferredValue value] on: Error
do:
Expand Down
7 changes: 4 additions & 3 deletions sources/JadeiteDebugger.cls
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ additionalAccelerators
^super additionalAccelerators , #(#(#reformatSource 'Ctrl+Shift+O') #(#jadeDebug 'Ctrl+B'))!

answer
[SessionManager inputState loopWhile: [answer isNil and: [debuggerClosed not]]] ensure: [^answer]!
[[answer isNil and: [debuggerClosed not]] whileTrue: [(Delay forMilliseconds: 1) wait]]
ensure: [^answer]!

basicSelectedFrame
| index |
Expand Down Expand Up @@ -294,8 +295,8 @@ getProcessList
gsProcess := debuggerService processes
detect: [:processService | processService oop = gsProcess oop]
ifNone: [gsProcess "it should be found though"].
debuggerService processes notEmpty
ifTrue: [processListPresenter selection: debuggerService processes first]!
processListPresenter list notEmpty
ifTrue: [processListPresenter selection: debuggerService processes first ifAbsent: []]!

homeFrame
^frameListPresenter list detect: [:str | str = (self homeFrameOf: frame) printString]!
Expand Down
6 changes: 3 additions & 3 deletions sources/Rowan UI Base.pax
Original file line number Diff line number Diff line change
Expand Up @@ -2754,7 +2754,7 @@ executeSelectionOrLine: contextObject
with: self currentSelectionOrLine
with: oop
with: window view handle value).
self issueCommand: answeringService.
self issueCommand: answeringService.
answer := self waitForAnswer: answeringService.
answer key ifTrue: [answer value: (OopType64 fromInteger: answer value)].
^answer!
Expand Down Expand Up @@ -5036,8 +5036,8 @@ executeSelectionOrLine: contextObject
answeringService
command: #exec:context:;
commandArgs: (Array with: self currentSelectionOrLine with: oop).
self issueCommand: answeringService.
answer := self waitForAnswer: answeringService.
self issueCommand: answeringService.
answer := self waitForAnswer: answeringService.
answer key ifTrue: [answer value: (OopType64 fromInteger: answer value)].
^answer!

Expand Down

0 comments on commit 067f899

Please sign in to comment.