The following sequence of events and conditions will cause a segfault to
occur:
1. Delete a misc_model
2. Undo the delete
3. Delete the same model again
4. Undo the delete
A segfault will occur in CEntityMiscModel::Draw when m_model is
dereferenced as it has been deleted and cleared.
When cloning the misc_model entity, a new CEntityMiscModel is created and
the name is set. However, CEntityMiscModel::BuildCacheRequestString relies
on all epairs to be present before being able to generate the *correct*
request string for the misc_model. Not doing so will cause incorrect
behaviour - in this case, the reference count for the CEntityMiscModel is
decremented one too many times and causes the object to be deleted. The
misc_model object is then used later on after it has been freed.
This commit fixes the problem by copying all epairs, before firing the
OnKeyValueChanged events. This way, all epairs will be available when
BuildCacheRequestString is called.