Hi everyone,

The statechart search for an event handler in post-order (children first then parent), however when we have orthogonal states involved then the behaviour I am experiencing is different.

Let say we have an state X with two children [orthogonal] states Y and W. Assuming none of the handlers discard (or defer) an event, the handler for that event is called in the following order: Y, X, W, X. Note that the handler of X is called twice. The following code demonstrates the issue:

<code>
struct EvTest : sc::event< EvTest > {};

struct Test;
struct Inner1;
struct Inner2;

struct Machine : sc::state_machine< Machine, Test > {};

struct Test : sc::simple_state<Test, Machine, mpl::list<Inner1, Inner2> >{
  typedef sc::custom_reaction< EvTest > reactions;

  sc::result react( const EvTest){
    std::cout << "Test" << std::endl;
//    return discard_event();
    return forward_event();
  }
};

struct Inner1 : sc::simple_state<Inner1, Test::orthogonal< 0 > >{};

struct Inner2 : sc::simple_state<Inner2, Test::orthogonal< 1 > >{
  typedef sc::custom_reaction< EvTest > reactions;

  sc::result react( const EvTest){
    std::cout << "Inner2" << std::endl;
    return forward_event();
  }
};
</code>

When the event "EvTest" is received, the output I am getting is:

<output>
Test
Inner2
Test
</output>

If there something that I am missing?

Best,
Ernesto Rodriguez Reina