The outliner is meant to check whether each object's data is currently
in the active mode when choosing whether to use "extend" behavior for
the mode switching column. That check worked for when the object data
is shared with the active object, but not any other object currently
in the active mode. The incorrect check caused the "extend" behavior
to turn off, making it exit edit mode for the object data without
handing the other objects using the data.
The simplest way of checking whether an object's data is in the active
mode is putting all the object data in a Set. Storing the set once
when building the outliner view context also avoids quadratic cost,
since the state needs to be checked for every object.
This does raise some questions about whether the mode is a property of
the object or the object data in practice. Also, I find the way the
outliner's callback is always "toggle" rather than "enter" or "exit" is
a bit weak. And the fact that the mode switching API allows this is
unfortunate as well. But this is the most clearly correct non-invasive
change to avoid the crash.