PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: openoli on February 27, 2013, 11:35:38



Title: Is there a Bug in pipeworks demo?
Post by: openoli on February 27, 2013, 11:35:38
Hello again,
while debugging the pipeworks demo again and again to understand all the things inside I'm wondering if there's a bug in the PrattlerModuleMediator.as.

My understanding is that after the FeedWindow's close event was fired we should only remove the module mediator of this concrete instance.
But the notification handler removes all registered instances?!

:
/**
* Handle PrattlerModule related Notifications.
* </P>
* Remove the application-level references to the module instance.
* Note that the module itself will also be listening for the
* window close and will do it's own internal cleanup to ensure
* that the instance can be garbage collected.</P>
*/
override public function handleNotification( note:INotification ):void
{
switch( note.getName() )
{
case  ApplicationFacade.REMOVE_FEED_WINDOW:
viewComponent = null;
var mediatorName:String = this.getMediatorName();
facade.removeMediator(mediatorName);
sendNotification(LogMessage.SEND_TO_LOG,"Removed window from shell.",LogMessage.LEVELS[LogMessage.DEBUG]);
break;
}
}


Should do something like this instead of the origin coding, or am I on the wrong track?:

:
/**
* Handle PrattlerModule related Notifications.
* </P>
* Remove the application-level references to the module instance.
* Note that the module itself will also be listening for the
* window close and will do it's own internal cleanup to ensure
* that the instance can be garbage collected.</P>
*/
override public function handleNotification( note:INotification ):void
{
switch( note.getName() )
{
case  ApplicationFacade.REMOVE_FEED_WINDOW:

if(viewComponent.getID() == note.getBody().moduleName as String)
{
viewComponent = null;
var mediatorName:String = this.getMediatorName();
facade.removeMediator(mediatorName);
sendNotification(LogMessage.SEND_TO_LOG,"Removed window from shell.",LogMessage.LEVELS[LogMessage.DEBUG]);
}
break;
}
}

Thanks for help!
Olaf


Title: Re: Is there a Bug in pipeworks demo?
Post by: puremvc on February 27, 2013, 01:51:40
Yes, it appears you are correct. Good catch!

In the case of the demo, it doesn't really make much of a difference, since we only need to get the feed window exported from those modules, but if there were more shell to module communications that happened over time, we might find that those suddenly fail because of this. (That's probably why this has never shown up as a problem).

-=Cliff>