|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r66496 - trunk/boost/statechart
From: ahd6974-boostorg_at_[hidden]
Date: 2010-11-11 15:04:13
Author: andreas_huber69
Date: 2010-11-11 15:04:12 EST (Thu, 11 Nov 2010)
New Revision: 66496
URL: http://svn.boost.org/trac/boost/changeset/66496
Log:
Fixes previously introduced corner case bug.
Text files modified:
trunk/boost/statechart/state_machine.hpp | 32 ++++++++++----------------------
1 files changed, 10 insertions(+), 22 deletions(-)
Modified: trunk/boost/statechart/state_machine.hpp
==============================================================================
--- trunk/boost/statechart/state_machine.hpp (original)
+++ trunk/boost/statechart/state_machine.hpp 2010-11-11 15:04:12 EST (Thu, 11 Nov 2010)
@@ -1,7 +1,7 @@
#ifndef BOOST_STATECHART_STATE_MACHINE_HPP_INCLUDED
#define BOOST_STATECHART_STATE_MACHINE_HPP_INCLUDED
//////////////////////////////////////////////////////////////////////////////
-// Copyright 2002-2008 Andreas Huber Doenni
+// Copyright 2002-2010 Andreas Huber Doenni
// Distributed under the Boost Software License, Version 1.0. (See accompany-
// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//////////////////////////////////////////////////////////////////////////////
@@ -274,9 +274,7 @@
{
if ( send_event( evt ) == detail::do_defer_event )
{
- // Before deferring, a reaction could post other events, which still
- // need to be processed. This is why we push the event at the beginning.
- eventQueueBegin_ = ++eventQueue_.insert( eventQueueBegin_, evt.intrusive_from_this() );
+ deferredEventQueue_.push_back( evt.intrusive_from_this() );
}
process_queued_events();
@@ -414,7 +412,6 @@
protected:
//////////////////////////////////////////////////////////////////////////
state_machine() :
- eventQueueBegin_( eventQueue_.begin() ),
currentStatesEnd_( currentStates_.end() ),
pOutermostState_( 0 ),
isInnermostCommonOuter_( false ),
@@ -647,7 +644,7 @@
void release_events()
{
- eventQueueBegin_ = eventQueue_.begin();
+ eventQueue_.splice( eventQueue_.begin(), deferredEventQueue_ );
}
@@ -905,23 +902,14 @@
void process_queued_events()
{
- while ( eventQueueBegin_ != eventQueue_.end() )
+ while ( !eventQueue_.empty() )
{
- typename event_queue_type::iterator currentEventQueueBegin =
- eventQueueBegin_++;
+ event_base_ptr_type pEvent = eventQueue_.front();
+ eventQueue_.pop_front();
- try
+ if ( send_event( *pEvent ) == detail::do_defer_event )
{
- if ( send_event( **currentEventQueueBegin ) !=
- detail::do_defer_event )
- {
- eventQueue_.erase( currentEventQueueBegin );
- }
- }
- catch ( ... )
- {
- eventQueue_.erase( currentEventQueueBegin );
- throw;
+ deferredEventQueue_.push_back( pEvent );
}
}
}
@@ -937,7 +925,7 @@
}
eventQueue_.clear();
- eventQueueBegin_ = eventQueue_.begin();
+ deferredEventQueue_.clear();
shallowHistoryMap_.clear();
deepHistoryMap_.clear();
}
@@ -1080,7 +1068,7 @@
event_queue_type eventQueue_;
- typename event_queue_type::iterator eventQueueBegin_;
+ event_queue_type deferredEventQueue_;
state_list_type currentStates_;
typename state_list_type::iterator currentStatesEnd_;
state_base_type * pOutermostState_;
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