Fixed undo_database

This commit is contained in:
Peter Conrad 2017-08-06 14:20:04 +02:00 committed by gladcow
parent 631849e7cc
commit e905534ea6

View file

@ -118,8 +118,6 @@ void undo_database::undo()
_db.insert( std::move(*item.second) );
_stack.pop_back();
if( _stack.empty() )
_stack.emplace_back();
enable();
--_active_sessions;
} FC_CAPTURE_AND_RETHROW() }
@ -127,6 +125,12 @@ void undo_database::undo()
void undo_database::merge()
{
FC_ASSERT( _active_sessions > 0 );
if( _active_sessions == 1 && _stack.size() == 1 )
{
_stack.pop_back();
--_active_sessions;
return;
}
FC_ASSERT( _stack.size() >=2 );
auto& state = _stack.back();
auto& prev_state = _stack[_stack.size()-2];