The for loop in removeFactoryCreator in InputManager increments i in each loop. This is not right because i cannot be incremented after a factoryObject has been erased (the iterator will be invalid). I guess the loop has to contain an else instead which increases i:
//First, destroy all devices created with the factory
for( FactoryCreatedObject::iterator i = mFactoryObjects.begin(); i != mFactoryObjects.end(); )
{
if( i->second == factory )
{
i->second->destroyObject(i->first);
mFactoryObjects.erase(i++);
}
else
++i;
}