#removeEventsTriggeredFor: bug?

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

#removeEventsTriggeredFor: bug?

Scott
I have found a potential bug in Dolphin Smalltalk version 4.01.3.

objectA := Object new.
objectB := Object new.
objectA
        when: #connect: send: #onConnect: to: objectB;
        when: #disconnect: send: #onDisconnect: to: objectB;
        when: #send:to: send: #onSend:to: to: objectB;
        when: #receive:from: send: #onReceive:from: to: objectB.
objectA events size.  "Should be 4"

objectA removeEventsTriggeredFor: objectB.
objectA events size  "Should be 0, but answers 1"

My work around for now is to call #removeEventsTriggeredFor: twice.

Thanks,
Scott


Reply | Threaded
Open this post in threaded view
|

Re: #removeEventsTriggeredFor: bug?

Blair McGlashan
"Scott" <[hidden email]> wrote in message
news:[hidden email]...

> I have found a potential bug in Dolphin Smalltalk version 4.01.3.
>
> objectA := Object new.
> objectB := Object new.
> objectA
> when: #connect: send: #onConnect: to: objectB;
> when: #disconnect: send: #onDisconnect: to: objectB;
> when: #send:to: send: #onSend:to: to: objectB;
> when: #receive:from: send: #onReceive:from: to: objectB.
> objectA events size.  "Should be 4"
>
> objectA removeEventsTriggeredFor: objectB.
> objectA events size  "Should be 0, but answers 1"
>
> My work around for now is to call #removeEventsTriggeredFor: twice.

Thanks Scott. It will be fixed in D5. A patch for D4 is below.

Regards

Blair

----------------------------------------------

!EventsCollection methodsFor!

removeEventsTriggeredFor: anObject
 "Private - Removes all events where the target is anObject.
 If the receiver becomes empty, answers nil, otherwise answers self."

 self keys do: [:each | self removeEvent: each triggeredFor: anObject].
 ^self asMinimumRepresentation! !
!EventsCollection categoriesFor:
#removeEventsTriggeredFor:!private!removing! !