When the modal operator passes events, free the internal state of the operator as we can't be sure those events don't cause the mesh data to be re-allocated or removed. Longer term it might be best to make this into a tool since the main purpose of this operator is to run other actions.