|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r65323 - trunk/boost/msm/back
From: christophe.j.henry_at_[hidden]
Date: 2010-09-06 16:17:09
Author: chenry
Date: 2010-09-06 16:17:01 EDT (Mon, 06 Sep 2010)
New Revision: 65323
URL: http://svn.boost.org/trac/boost/changeset/65323
Log:
bugfix: guard always returning false with an anonymous transition causes stack overflow
Text files modified:
trunk/boost/msm/back/state_machine.hpp | 31 ++++++++++++++++++++++++++-----
1 files changed, 26 insertions(+), 5 deletions(-)
Modified: trunk/boost/msm/back/state_machine.hpp
==============================================================================
--- trunk/boost/msm/back/state_machine.hpp (original)
+++ trunk/boost/msm/back/state_machine.hpp 2010-09-06 16:17:01 EDT (Mon, 06 Sep 2010)
@@ -991,6 +991,11 @@
{
ret_handled = HANDLED_TRUE;
}
+
+ // process completion transitions BEFORE any other event in the pool (UML Standard 2.3 §15.3.14)
+ handle_eventless_transitions_helper<library_sm> eventless_helper(this,(handled == HANDLED_TRUE));
+ eventless_helper.process_completion_event();
+
// after handling, take care of the deferred events
defer_helper.do_post_handle_deferred(handled);
@@ -998,15 +1003,31 @@
// because of another processing, and if yes, start handling them
do_post_msg_queue_helper(::boost::mpl::bool_<is_no_message_queue<library_sm>::type::value>());
- // event can be handled, processing
- // handle with lowest priority event-less transitions
- handle_eventless_transitions_helper<library_sm> eventless_helper(this,(handled!=HANDLED_FALSE));
- eventless_helper.process_completion_event();
-
return ret_handled;
}
}
+ // Tries to process a completion event (useful if a previous one was rejected by a guard).
+ execute_return process_completion()
+ {
+ typedef typename ::boost::mpl::deref<
+ typename ::boost::mpl::begin<
+ typename find_completion_events<library_sm>::type
+ >::type
+ >::type first_completion_event;
+
+ // if the state machine has terminate or interrupt flags, check them, otherwise skip
+ if (is_event_handling_blocked_helper<first_completion_event>
+ ( ::boost::mpl::bool_<has_fsm_blocking_states<library_sm>::type::value>() ) )
+ return HANDLED_TRUE;
+
+ // process completion transitions BEFORE any other event in the pool (UML Standard 2.3 §15.3.14)
+ handle_eventless_transitions_helper<library_sm> eventless_helper(this,true);
+ eventless_helper.process_completion_event();
+
+ return HANDLED_TRUE;
+ }
+
// Getter that returns the current state of the FSM
const int* current_state() const
{
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk