Boost logo

Boost Users :

Subject: [Boost-users] [MSM] stack overflow happens when there is a false-guard anonymous transition
From: Tang Jiang Jun (tangjiangjun_at_[hidden])
Date: 2010-09-04 10:20:43


Hello guys,

I met a stack overflow crash in the following MSM sample (boost 1.44).

struct Some_Event {};

struct State0 : public msm::front::state<> {};

struct State1 : public msm::front::state<> {};

struct State2 : public msm::front::state<> {};

struct State_Machine_ : public msm::front::state_machine_def< State_Machine_
>
{
typedef State0 initial_state;

template< typename Event >
bool is_possible( const Event& )
{
return false;
}

struct transition_table : public mpl::vector<
_row< State0, Some_Event, State1 >,
g_row< State0, msm::front::none, State2, &State_Machine_::is_possible >
> {};
};

struct State_Machine : public msm::back::state_machine< State_Machine_ > {};

void main()
{
State_Machine state_machine;
state_machine.start();
state_machine.process_event( Some_Event() );
}

When start() got called in main(), it will enter a
endless reentering between state_machine::process_event() and
state_machine::handle_eventless_transitions_helper::process_completion_event().
Finally it caused a stack overflow.

Could somebody please help me to fix this problem?

Many thanks!

Regards,
Tang



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net