The only crash I experienced was due to a dependency between sharedContext and contextDestroyCallbacks.
Since both are static they are only accessed from within GLContext.cpp the issue can be resolved by putting those two into a static struct and manually destructing the sharedContext first:
static struct SharedContextStruct {
~SharedContextStruct() noexcept
{
sharedContext.reset();
}
std::unique_ptr<ContextType> sharedContext;
ContextDestroyCallbacks contextDestroyCallbacks;
} sharedContextData;
This doesn't change any of the other interactions with these objects, except to add the member access, but will ensure that sharedContext is always destroyed before contextDestroyCallbacks.
EDIT: There shouldn't be any risk of accessing already destroyed objects through this, since those objects destructors should have removed them from the calback list.