Skip to content

Commit

Permalink
Fixing a memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Oct 19, 2024
1 parent 1307ac8 commit 070ae5f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
16 changes: 16 additions & 0 deletions repository/OpenPonk-Core/SpAbstractPresenter.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Extension { #name : 'SpAbstractPresenter' }

{ #category : '*OpenPonk-Core' }
SpAbstractPresenter >> whenWindowClosedDo: aBlock [

self withWindowEnsureDo: [ :window | window whenClosedDo: aBlock ]
]

{ #category : '*OpenPonk-Core' }
SpAbstractPresenter >> withWindowEnsureDo: aBlock [

self hasWindow ifFalse: [
^ self whenBuiltDo: [ aBlock value: self root ] ].

aBlock value: self root
]
3 changes: 1 addition & 2 deletions repository/OpenPonk-Spec/OPDiagramsList.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,8 @@ OPDiagramsList >> project [
OPDiagramsList >> project: aProject [

project := aProject.
self whenWindowClosedDo: [ project unsubscribe: self ].
project whenChanged: [ self updateContent ].
self withWindowDo: [ :window |
window whenClosedDo: [ project unsubscribe: self ] ].
self updateContent.
self workbench announcer
when: OPEditorUnfocused
Expand Down
5 changes: 2 additions & 3 deletions repository/OpenPonk-Spec/OPWorkbench.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,13 @@ OPWorkbench >> openProject: aProject [
project: project;
workbench: self.
topToolbar updateProjectMenu.
self whenWindowClosedDo: [ project unsubscribe: self ].
project whenChanged: [ self updateTitle ].
diagramsList project: project.
projectTree openOn: project.
projectController openDiagrams.
self hasWindow ifFalse: [ self open ].
self withWindowDo: [ :window |
window whenClosedDo: [ project unsubscribe: self ] ].
self updateTitle.
self updateTitle
]

{ #category : 'opening' }
Expand Down

0 comments on commit 070ae5f

Please sign in to comment.