Comment #1 on issue 492 by esteba...(a)gmail.com: Glamour browsers do not
release all subscriptions to announcer objects
ok... it is more complicated than I thought... this is what I dug for now
(sorry, this is large):
1) the fix proposed originaly is still necesary.
2) GLMBrowser>>unregisterFromAllAnnouncements needs to be defined this way:
self panes do: [:each |
each presentations unregisterFromAllAnnouncements ].
self transmissions do: [ :each |
each destination pane unregisterFromAllAnnouncements ]
(this include panes in transmissions in the clean up)
3) this is the ugly part: there is an identity problem, because
GLMUpdateActions are being copied a lot of times, to ensure the browser
function. And unsubscribe: checks for identical objects (==) to remove from
the annoncements. So... and THIS IS NOT THE SOLUTION, just a validation of
the problem. I did:
a) I added a method to Announcer:
subscriptions ifNil: [ ^ self ].
subscriptions keysAndValuesDo: [ :class :actions |
subscriptions at: class put: (actions
reject: [ :each | each receiver = anObject ]) ].
subscriptions keysAndValuesRemove: [ :class :actions |
actions isEmpty ]
(it just changes the check by == to a check by =)
b) assign an unique id, = and hash to GLMUpdateAction:
^id ifNil: [ id = UUID new asString ]
self species = other species ifFalse: [ ^false ].
^self id = other id
^self species hash bitXor: self id hash
do: [:each | each unsubscribeNonIdentical: self ]
and with all this changes... announcement un-suscription is working :P
this is the test who validates it:
| announcer browser presentation |
announcer := Announcer new.
browser := GLMTabulator new.
browser row: #one.
andShow: [ :presenter |
(presentation := presenter list)
updateOn: TestAnnouncement from: [ announcer ];
display: [ :start | start to: 10 ] ].
browser startOn: 1.
self assert: (announcer instVarNamed: 'subscriptions') isEmpty.
So... this makes the un-suscription works, but the whole "id" thing is
really-really ugly. So, as I don't know much of Glamour, maybe you can say
me a real fix for this :)