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 ] Remove commands  (Read 12107 times)
gabon
Jr. Member
**
Posts: 14


View Profile Email
« on: March 11, 2008, 09:35:50 »

In a medium size application I was willing to register and unregister the commands when entering/leaving the section.
The second time I enter in the section the command (that has been removed on leaving) is fired twice. I think I posted already about it but with the new forum it has been lost. Anyway, if I remember well, the problem that time, that was fixed with a later revision, was that if I register two commands to the same event I had an unexpected behavior. Now I found out that if I register the same command twice after having unregistered it, it generates two observers and so gets fired twice. I personally see this as a bug because if I want to remove a command I don't want that any reference to it still exists, so I can register it again as brand new.

Thanks, chr
« Last Edit: March 17, 2008, 04:34:46 by puremvc » Logged
gabon
Jr. Member
**
Posts: 14


View Profile Email
« Reply #1 on: March 11, 2008, 09:40:57 »

I found the post and was:

http://forums.puremvc.org/index.php?topic=270.0

well, the problem seem similar, I had some problems with the vss so I wasn't sure if my swc 1.7.1 was the fixed one, so I downloaded the 1.7.1 source code from its tag in the svn and I still have the issue. I checked then the 2.0.1 source code and the controller still register a new observer everytime I set a command. I'm going now to try the 2.0.1 source with the fingers crossed :)


Cheers, chr
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #2 on: March 11, 2008, 11:27:04 »

Hi gabon,

This was finally identified after your post but before 2.0.1 release. The problem is that on Controller.removeCommand, there is no easy way to remove the associated observer in the View. Adding a removeObserver method in the View is a possibility. Considering that much of the sturm und drang up to now in terms of bug fixes has been related to getting removeMediator to work properly the idea of refactoring it for this release was not attractive.

This issue is noted at the bottom of the release notes for 2.0.1:
http://trac.puremvc.org/PureMVC_AS3/wiki/ReleaseNotes

Known Issues

    * If you remove the Command for a given Notification name, then re-register any Command to that same Notification name, the new Command will be executed twice when that Notification is sent. This is because the Controller removes the Command from its commandMap, but currently has no way to remove the Observer from the Notification list because that is in the View, and there is no removeObserver method. Since this is an edge case, and would require refactoring of a particularly important section of the framework, it is being deferred until after the 2.0.1 release.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: March 17, 2008, 04:34:05 »

Fixed. See AS3 Standard Version 2.0.2 Release Notes and Unit Tests.

-=Cliff>
Logged
Pages: [1]
Print