Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: [FIXED] removeMediator is it a bug?  (Read 8495 times)
panupan
Newbie
*
Posts: 1


View Profile Email
« on: August 12, 2008, 10:51:05 »

Hello.  I ran across this, is this a bug?



In TestMediator.as I have:

:

private static var counter:int = 1;
private var NAME:String = 'TestMediator' + counter++;
public static const REMOVE_TEST_MEDIATORS:String = 'removetestmediators';

public function TestMediator()
{
super(NAME, null);
}

override public function listNotificationInterests():Array {
return [REMOVE_TEST_MEDIATORS];
}

override public function onRegister():void {
trace(NAME+'.onRegister');
}

override public function onRemove():void {
trace(NAME+'.onRemove ');
}

override public function handleNotification(notification:INotification):void {
trace(NAME+'.handleNotification->'+notification.getName());
switch (notification.getName()) {
case REMOVE_TEST_MEDIATORS:
facade.removeMediator(NAME);
break;
default:
}
}

In BugTest.mxml I have:

:
private var facade:ApplicationFacade = ApplicationFacade.getInstance('bugtest');

private function onCreationComplete(event:Event):void {
facade.registerMediator(new TestMediator());
facade.registerMediator(new TestMediator());
facade.registerMediator(new TestMediator());
facade.registerMediator(new TestMediator());
facade.registerMediator(new TestMediator());
facade.sendNotification(TestMediator.REMOVE_TEST_MEDIATORS);
}


When I run this program, I get this output:

:
TestMediator1.onRegister
TestMediator2.onRegister
TestMediator3.onRegister
TestMediator4.onRegister
TestMediator5.onRegister
TestMediator1.handleNotification->removetestmediators
TestMediator1.onRemove
TestMediator3.handleNotification->removetestmediators
TestMediator3.onRemove
TestMediator5.handleNotification->removetestmediators
TestMediator5.onRemove


What happened to 2 and 4?  Is it wrong to remove mediators in this manner?

Thanks a lot.
« Last Edit: April 06, 2009, 03:48:12 by puremvc » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: August 13, 2008, 08:46:38 »

This is related to this bug reported on the Standard Version:  http://forums.puremvc.org/index.php?topic=490.0

It will be fixed at the same time. Since it is easy to work around, I've been awaiting other bugs to accompany it in a fix-fest, but none have cropped up so another release should happen shortly.

-=Cliff>
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #2 on: April 06, 2009, 03:48:37 »

Sorry, forgot to mention this was fixed in the last version.
-=Cliff>
Logged
Pages: [1]
Print