Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Jul 2009
    Posts
    12
    Vote Rating
    0
    aconn7 is on a distinguished road

      0  

    Default [FIXED] Dispatcher fix for concurrent access error add new controller

    [FIXED] Dispatcher fix for concurrent access error add new controller


    Iterating over a "copy" of the controller list should eliminate concurrent access errors that occur when trying to add a controller in the middle of an event being dispatched.

    This is the same technique that is used in BaseObservable


    Code:
      private void dispatch(AppEvent event, boolean createhistory) {
        MvcEvent e = new MvcEvent(this, event);
        e.setAppEvent(event);
        if (fireEvent(BeforeDispatch, e)) {
          List<Controllers> copy = new ArrayList<Controllers>(controllers); 
          for (Controller controller : copy) {
            if (controller.canHandle(event)) {
              if (!controller.initialized) {
                controller.initialized = true;
                controller.initialize();
              }
              controller.handleEvent(event);
            }
          }
          fireEvent(AfterDispatch, e);
        }
        if (createhistory && event.isHistoryEvent()) {
          String token = event.getToken();
          if (token == null) {
            token = "" + new Date().getTime();
          }
          history.put(token, event);
          History.newItem(token, false);
        }
      }
    
    }

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,716
    Vote Rating
    107
    sven is just really nice sven is just really nice sven is just really nice sven is just really nice

      0  

    Default


    Fixed in SVN