Repository: flutter
Issue: Linux//AOT/Windows: Crash with multiple engines after deleting first engine
Labels: c: crash,engine,platform-windows,platform-linux,P2,c: fatal crash,team-engine,triaged-engine

Crash when moving cursor in remaining isolate:
<details>
  <summary>Stacktrace</summary>
  <pre>
unsigned long std::__1::__cxx_atomic_load<unsigned long>(std::__1::__cxx_atomic_base_impl<unsigned long> const*, std::__1::memory_order) (/home/matej/Projects/flutter/engine/src/third_party/libcxx/include/atomic:970)
std::__1::__atomic_base<unsigned long, false>::load(std::__1::memory_order) const (/home/matej/Projects/flutter/engine/src/third_party/libcxx/include/atomic:1487)
dart::UntaggedObject::HashTag::Type dart::UntaggedObject::Tags<unsigned long>::Read<dart::UntaggedObject::HashTag>() const (/home/matej/Projects/flutter/engine/src/third_party/dart/runtime/vm/raw_object.h:285)
dart::UntaggedObject::GetHeaderHash() const (/home/matej/Projects/flutter/engine/src/third_party/dart/runtime/vm/raw_object.h:448)
dart::Object::GetCachedHash(dart::ObjectPtr) (/home/matej/Projects/flutter/engine/src/third_party/dart/runtime/vm/object.h:417)
dart::String::Hash() const (/home/matej/Projects/flutter/engine/src/third_party/dart/runtime/vm/object.h:9077)
dart::NewByteData(dart::Thread*, long) (/home/matej/Projects/flutter/engine/src/third_party/dart/runtime/vm/dart_api_impl.cc:3784)
::Dart_NewTypedData(Dart_TypedData_Type, intptr_t) (/home/matej/Projects/flutter/engine/src/third_party/dart/runtime/vm/dart_api_impl.cc:3879)
tonic::DartByteData::DartByteData(void const*, unsigned long) (/home/matej/Projects/flutter/engine/src/flutter/third_party/tonic/typed_data/dart_byte_data.cc:45)
tonic::DartByteData::Create(void const*, unsigned long) (/home/matej/Projects/flutter/engine/src/flutter/third_party/tonic/typed_data/dart_byte_data.cc:27)
flutter::Window::DispatchPointerDataPacket(flutter::PointerDataPacket const&) (/home/matej/Projects/flutter/engine/src/flutter/lib/ui/window/window.cc:41)
flutter::RuntimeController::DispatchPointerDataPacket(flutter::PointerDataPacket const&) (/home/matej/Projects/flutter/engine/src/flutter/runtime/runtime_controller.cc:236)
flutter::Engine::DoDispatchPacket(std::__1::unique_ptr<flutter::PointerDataPacket, std::__1::default_delete<flutter::PointerDataPacket> >, unsigned long) (/home/matej/Projects/flutter/engine/src/flutter/shell/common/engine.cc:536)
flutter::DefaultPointerDataDispatcher::DispatchPacket(std::__1::unique_ptr<flutter::PointerDataPacket, std::__1::default_delete<flutter::PointerDataPacket> >, unsigned long) (/home/matej/Projects/flutter/engine/src/flutter/shell/common/pointer_data_dispatcher.cc:23)
flutter::Engine::DispatchPointerDataPacket(std::__1::unique_ptr<flutter::PointerDataPacket, std::__1::default_delete<flutter::PointerDataPacket> >, unsigned long) (/home/matej/Projects/flutter/engine/src/flutter/shell/common/engine.cc:437)
flutter::Shell::OnPlatformViewDispatchPointerDataPacket(std::__1::unique_ptr<flutter::PointerDataPacket, std::__1::default_delete<flutter::PointerDataPacket> >)::$_10::operator()() (/home/matej/Projects/flutter/engine/src/flutter/shell/common/shell.cc:963)
auto fml::internal::CopyableLambda<flutter::Shell::OnPlatformViewDispatchPointerDataPacket(std::__1::unique_ptr<flutter::PointerDataPacket, std::__1::default_delete<flutter::PointerDataPacket> >)::$_10>::operator()<>() const (/home/matej/Projects/flutter/engine/src/flutter/fml/make_copyable.h:24)
decltype(std::__1::forward<fml::internal::CopyableLambda<flutter::Shell::OnPlatformViewDispatchPointerDataPacket(std::__1::unique_ptr<flutter::PointerDataPacket, std::__1::default_delete<flutter::PointerDataPacket> >)::$_10>&>(fp)()) std::__1::__invoke<fml::internal::CopyableLambda<flutter::Shell::OnPlatformViewDispatchPointerDataPacket(std::__1::unique_ptr<flutter::PointerDataPacket, std::__1::default_delete<flutter::PointerDataPacket> >)::$_10>&>(fml::internal::CopyableLambda<flutter::Shell::OnPlatformViewDispatchPointerDataPacket(std::__1::unique_ptr<flutter::PointerDataPacket, std::__1::default_delete<flutter::PointerDataPacket> >)::$_10>&) (/home/matej/Projects/flutter/engine/src/third_party/libcxx/include/type_traits:3530)
void std::__1::__invoke_void_return_wrapper<void>::__call<fml::internal::CopyableLambda<flutter::Shell::OnPlatformViewDispatchPointerDataPacket(std::__1::unique_ptr<flutter::PointerDataPacket, std::__1::default_delete<flutter::PointerDataPacket> >)::$_10>&>(fml::internal::CopyableLambda<flutter::Shell::OnPlatformViewDispatchPointerDataPacket(std::__1::unique_ptr<flutter::PointerDataPacket, std::__1::default_delete<flutter::PointerDataPacket> >)::$_10>&) (/home/matej/Projects/flutter/engine/src/third_party/libcxx/include/__functional_base:348)
std::__1::__function::__alloc_func<fml::internal::CopyableLambda<flutter::Shell::OnPlatformViewDispatchPointerDataPacket(std::__1::unique_ptr<flutter::PointerDataPacket, std::__1::default_delete<flutter::PointerDataPacket> >)::$_10>, std::__1::allocator<fml::internal::CopyableLambda<flutter::Shell::OnPlatformViewDispatchPointerDataPacket(std::__1::unique_ptr<flutter::PointerDataPacket, std::__1::default_delete<flutter::PointerDataPacket> >)::$_10> >, void ()>::operator()() (/home/matej/Projects/flutter/engine/src/third_party/libcxx/include/functional:1533)
</pre>
</details>

As far as I can tell the problem is that first isolate vm data is used to initialize Dart VM (and in turn `dart::Symbols`), but then the isolate data is collected when destroying the first engine. Memory is freed and any access of symbol backed by this memory segfaults.