Skip to content

Commit

Permalink
making the debugger action model trigger its #clear event when the de…
Browse files Browse the repository at this point in the history
…bug session's #clear event is raised; in order to unsubscribe from everything automatically
  • Loading branch information
adri09070 committed Sep 15, 2023
1 parent a79ff82 commit d0c4d9f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
29 changes: 29 additions & 0 deletions src/NewTools-Debugger-Tests/StDebuggerActionModelTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,35 @@ StDebuggerActionModelTest >> testDynamicShouldFilterStackUpdate [



]

{ #category : #'tests - actions' }
StDebuggerActionModelTest >> testEventAfterClear [

| dummyActionModel dummyDebugger |
dummyDebugger := StDummyDebuggerPresenter new.

dummyActionModel := StTestDebuggerProvider new debuggerWithDNUContext
debuggerActionModel.
self changeSession: dummyActionModel session.
dummyActionModel clear.

debugActionModel
when: StDebuggerActionModelClearAnnouncement
send: #tag:
to: dummyDebugger.

self assert: dummyDebugger tag isNil.

debugActionModel clear.

self deny: dummyDebugger tag isNil.
self
assert: dummyDebugger tag class
identicalTo: StDebuggerActionModelClearAnnouncement.
self
assert: dummyDebugger tag debuggerActionModel
identicalTo: debugActionModel
]

{ #category : #'tests - actions' }
Expand Down
6 changes: 2 additions & 4 deletions src/NewTools-Debugger/StDebugger.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,7 @@ StDebugger >> clear [

"When we programmatically close the window, we do not need to terminate the session as it was already cleared"
programmaticallyClosed ifTrue: [ ^ self ].
self clearDebugSession.
debuggerActionModel := nil
self clearDebugSession
]

{ #category : #'updating - widgets' }
Expand Down Expand Up @@ -504,8 +503,7 @@ StDebugger >> debuggerActionModel [
StDebugger >> debuggerActionModelCleared [

self unsubscribeFromActionModel.
self unsubscribeFromSystemAnnouncer.
debuggerActionModel := nil
self unsubscribeFromSystemAnnouncer
]

{ #category : #accessing }
Expand Down
6 changes: 3 additions & 3 deletions src/NewTools-Debugger/StDebuggerActionModel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ StDebuggerActionModel >> clearDebugSession [
contextPredicate := nil.
self session
terminate;
clear.
session := nil
clear
]

{ #category : #context }
Expand Down Expand Up @@ -370,7 +369,8 @@ StDebuggerActionModel >> registerActionsForSession: aSession [
when: #stepInto send: #updateStep to: self;
when: #stepOver send: #updateStep to: self;
when: #stepThrough send: #updateStep to: self;
when: #contextChanged send: #updateContextChanged to: self ]
when: #contextChanged send: #updateContextChanged to: self;
when: #clear send: #clear to: self ]
]

{ #category : #'events - removing' }
Expand Down

0 comments on commit d0c4d9f

Please sign in to comment.