Issue 253 in glassdb: unsubscribing in middle of event handling is Trouble for Announcements

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 253 in glassdb: unsubscribing in middle of event handling is Trouble for Announcements

glassdb
Status: Accepted
Owner: [hidden email]
Labels: Type-Defect Priority-Medium GLASS-Server Version-GLASS0.231  
Milestone-1.0-beta.8.7

New issue 253 by [hidden email]: unsubscribing in middle of event  
handling is Trouble for Announcements
http://code.google.com/p/glassdb/issues/detail?id=253

see the discussion ...

   http://forum.world.st/Announcements-problem-td3348262.html

best bet is to first take a look at the most recent version of  
announcements and update ...



Reply | Threaded
Open this post in threaded view
|

Re: Issue 253 in glassdb: unsubscribing in middle of event handling is Trouble for Announcements

glassdb

Comment #1 on issue 253 by [hidden email]: unsubscribing in middle of  
event handling is Trouble for Announcements
http://code.google.com/p/glassdb/issues/detail?id=253

Here's problem description:

I found that some components are unsubscribed within de action sequence  
block, and that seems to be the problem.

In Squeak, the same code works correctly.
Once the announcement is executed the current component is replaced with  
another, and I need to unsubscribe the previous one.


CMSPanel>>registerAnnouncements

self session announcer
         on: EditRecordItemSelected
         do: [ :each | self editRecord: each item. ].

editRecord: aRecord

     self current: (RecordEditor for: aRecord)

CMSPanel>>current: aComponent

     self session announcer unsubscribe: current.
     current := aComponent.

If I comment the the first line, then the application stop crashing.

Reply | Threaded
Open this post in threaded view
|

Re: Issue 253 in glassdb: unsubscribing in middle of event handling is Trouble for Announcements

glassdb

Comment #2 on issue 253 by [hidden email]: unsubscribing in middle of  
event handling is Trouble for Announcements
http://code.google.com/p/glassdb/issues/detail?id=253

It looks like the problem is stemming from the fact that the unsubscribe:  
method is removing things from the IdentityDictionary while the announce:  
code is traversing the keys and values of the dictionary which is usually  
unsafe thing to do ...

The fact that is working in Squeak is probably due to the fact that the  
internal implmentation is different enough that you either aren't tripping  
over the same type of issue or the problem doesn't exist in that  
implementation ...

should be possbile to fix the way the announcements work ...

Reply | Threaded
Open this post in threaded view
|

Re: Issue 253 in glassdb: unsubscribing in middle of event handling is Trouble for Announcements

glassdb

Comment #3 on issue 253 by [hidden email]: unsubscribing in middle of  
event handling is Trouble for Announcements
http://code.google.com/p/glassdb/issues/detail?id=253

If you collect the list of actions while traversing the subscriptions, and  
then evaluate the actions afterword, there should be no problem with an  
action doing an unsubscribe. Announcer>>announce:

announce: anAnnouncement
        | announcement actionList |
        announcement := anAnnouncement asAnnouncement.
        actionList := OrderedCollection new.
        subscriptions keysAndValuesDo: [ :class :actions |
                (class handles: announcement)
                        ifTrue: [ actionList add: {actions. announcement} ]].
        actionList do: [:array |  (array at: 1) valueWithArguments: (Array with:  
(array at: 2)) ].
        ^ announcement



Reply | Threaded
Open this post in threaded view
|

Re: Issue 253 in glassdb: unsubscribing in middle of event handling is Trouble for Announcements

glassdb
Updates:
        Status: Fixed
        Labels: Fixed-1.0-beta.8.7

Comment #4 on issue 253 by [hidden email]: unsubscribing in middle of  
event handling is Trouble for Announcements
http://code.google.com/p/glassdb/issues/detail?id=253

This should take care of the issue ... at least the events are not executed  
while traversing elements of the IdentityDictionary.

Name: Announcements.g-DaleHenrichs.14
Author: DaleHenrichs
Time: 03/22/2011, 16:51:03
UUID: 33837711-7e19-4fe8-9973-16cc4322fbdf
Ancestors: Announcements.g-DaleHenrichs.13