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

Show Posts

* | |

  Show Posts
Pages: [1]
1  PureMVC Manifold / Demos and Utils / Re: DesktopCitizen - A PureMVC AS3 / AIR Utility on: February 26, 2009, 06:57:42
Hi,

I found a possible error in the WindowCloseCommand, the NAME constant have this value :

"public class WindowCloseCommand extends SimpleCommand
   {
      public static const NAME:String = 'DestopCitizenWindowOpenCommand';"

I think this is an error and the NAME constant must be 'DestopCitizenWindowCloseCommand'

Best regards,
Marc
2  PureMVC Manifold / Bug Report / [EDGE CASE / ANTIPATTERN] Remove observer error on: August 15, 2008, 12:18:14
Hi,

I report to you a bug when I try to remove a mediator, the observers result is null in the View class and removeObserver method.

This is normal in my case that the return value is null because I update dynamically the listNotificationInterests in the mediator and one of these was not registered. (I remove and insert it to update this list )


I propose a solution to put in the removeObserver method ,

if( !observers ){ //correct null error
   return ;
}

Thanks.

Best regards,
Marc
3  PureMVC Manifold / Bug Report / Re: [WILL FIX] notifyObservers 'lose' data on: June 04, 2008, 11:27:40
Thank for your other solution.

Marc
4  PureMVC Manifold / Bug Report / Re: notifyObservers 'lose' data on: June 04, 2008, 05:56:43
I found a solution which work correctly :

( observerMap[ notification.getName() ] != null ) {
   var observers_ref:Array = observerMap[ notification.getName() ] as Array;
   var observers:Array = new Array(); //tempory copy (not deep copy, shallow copy... work fine)
   var observer:IObserver;
   
   for (var i:Number = 0; i < observers_ref.length; i++) { //copy the reference
      observer = observers_ref[ i ] as IObserver;
      observers.push(observer);
   }
   
   for (i = 0; i < observers.length; i++) { //notify the observer
      observer = observers[ i ] as IObserver;
      observer.notifyObserver( notification );
   }
}

Marc
5  PureMVC Manifold / Bug Report / [ FIXED ] If observer list changes during notification some observers are missed on: June 04, 2008, 05:45:22
hi,

I have a problem with the notifyObservers method in the class View.

I explain, 2 mediators are attach to a same Notification 'CloseView' and when I send it, only one mediator receive it...

It's 'normal' when you analyse the notifyObservers method. When the 'CloseView' notification is received my Mediator is removed from the Facade and by consequence it removed from the observers attribut list (by reference). the var i = 1 and when the next step of 'for' is call observers.length = 1 not 2 (not such as previously) and the second observer is never notified....

//current method
if( observerMap[ notification.getName() ] != null ) {
   var observers:Array = observerMap[ notification.getName() ] as Array;
   for (var i:Number = 0; i < observers.length; i++) {
      var observer:IObserver = observers[ i ] as IObserver;
      observer.notifyObserver( notification );
   }
}

my idea to solve this problen is to clone (deep copy) the observers to unlink the memory reference temporaly.

Someone have an idea about this problem ? And how create a deep copy because the Observer are not correctly copy by the method ObjectUtil.copy(observers);

Best regards,
Marc
Pages: [1]