The crash happens because the origindex layers created as part of
the modifier stack evaluation are not set in the MeshRenderData when
they should have been.
This is because when selecting in X-ray mode, a subdivision wrapper
is created to ensure that selection happens with a subdivided
geometry, and this replaces the MDATA wrapper which is also used to
setup the MeshRenderData.
As we do not seemingly have an MDATA wrapper, the draw code decides
that we can extract draw buffers directly from the BMesh, instead of
the mapped Mesh with origin indices layers.
To fix this, we should also consider to use mapped extraction if a
subdivision wrapper exists on the mesh.
CC @Brecht Van Lommel (brecht), @Campbell Barton (campbellbarton), @Sergey Sharybin (sergey), as this seems to be the first
case of two different wrappers colliding and may have design implications.