This patch fixes T72667: Outliner "delete hierarchy" crash with a mesh in edit-mode, however it's more a design decision, which has further implications.
Note that this issue could be fixed differently - however I looked into some alternatives such as...
- Supporting keeping the mesh in edit-mode without an object. While this could be made to work, there are quite a few complications with the draw manager - making this a larger change then I would have expected... there are also a bug outside the scope of this patch - see T72848.
- Removing BMEditMesh.ob pointer which resolves the initial crash, leaving other non-trivial issues to resolve.
If we go with this fix, there are further changes that should be made for completeness, although I don't consider them blockers.
- Add the ability to exit edit-mode for all other object types (not just edit-mesh).
- Add the ability to flush sculpt data (currently un-linking an object in sculpt mode wont flush it's data to the mesh).