Comment #1 on issue 492 by esteba...@gmail.com: Glamour browsers do not release all subscriptions to announcer objects http://code.google.com/p/moose-technology/issues/detail?id=492
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:
unregisterFromAllAnnouncements super unregisterFromAllAnnouncements. 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:
Announcer>>unsubscribeNonIdentical: anObject 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 ^id ifNil: [ id = UUID new asString ]
= other self species = other species ifFalse: [ ^false ]. ^self id = other id
hash ^self species hash bitXor: self id hash
c) modify
GLMUpdateAction>>unregisterFromAllAnnouncements self announcerObjects do: [:each | each unsubscribeNonIdentical: self ]
and with all this changes... announcement un-suscription is working :P this is the test who validates it:
GLMUpdateAction>>testUnregisterAnnouncementsWhenUpdatingPane | announcer browser presentation | announcer := Announcer new. browser := GLMTabulator new. browser row: #one. browser transmit to: #one; andShow: [ :presenter | (presentation := presenter list) updateOn: TestAnnouncement from: [ announcer ]; display: [ :start | start to: 10 ] ]. browser startOn: 1. presentation registerAnnouncements. browser unregisterFromAllAnnouncements.
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 :)