Repository: flutter
Issue: Dispatched platform message that are not handled due to isolate death are leaked.
Labels: engine,from: sanitizer,P2,team-engine,triaged-engine

Caught by leak sanitizer in the `embedder_unittests` harness.

```
Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x1169f3522 in wrap__Znwm (libclang_rt.asan_osx_dynamic.dylib:x86_64+0x66522)
    #1 0x1090252b4 in FlutterEngineRun::$_36::operator()(fml::RefPtr<flutter::PlatformMessage>) const embedder.cc:740
    #2 0x1090250af in decltype(std::__1::forward<FlutterEngineRun::$_36&>(fp)(std::__1::forward<fml::RefPtr<flutter::PlatformMessage> >(fp0))) std::__1::__invoke<FlutterEngineRun::$_36&, fml::RefPtr<flutter::PlatformMessage> >(FlutterEngineRun::$_36&&&, fml::RefPtr<flutter::PlatformMessage>&&) type_traits:4350
    #3 0x109024ebf in void std::__1::__invoke_void_return_wrapper<void>::__call<FlutterEngineRun::$_36&, fml::RefPtr<flutter::PlatformMessage> >(FlutterEngineRun::$_36&&&, fml::RefPtr<flutter::PlatformMessage>&&) __functional_base:349
    #4 0x109020ea6 in std::__1::__function::__func<FlutterEngineRun::$_36, std::__1::allocator<FlutterEngineRun::$_36>, void (fml::RefPtr<flutter::PlatformMessage>)>::operator()(fml::RefPtr<flutter::PlatformMessage>&&) functional:1572
    #5 0x1090cdb91 in std::__1::function<void (fml::RefPtr<flutter::PlatformMessage>)>::operator()(fml::RefPtr<flutter::PlatformMessage>) const functional:1923
    #6 0x1090cd97d in flutter::PlatformViewEmbedder::HandlePlatformMessage(fml::RefPtr<flutter::PlatformMessage>) platform_view_embedder.cc:63
    #7 0x10c744bee in flutter::Shell::OnEngineHandlePlatformMessage(fml::RefPtr<flutter::PlatformMessage>)::$_31::operator()() const shell.cc:937
    #8 0x10c7449ea in decltype(std::__1::forward<flutter::Shell::OnEngineHandlePlatformMessage(fml::RefPtr<flutter::PlatformMessage>)::$_31&>(fp)()) std::__1::__invoke<flutter::Shell::OnEngineHandlePlatformMessage(fml::RefPtr<flutter::PlatformMessage>)::$_31&>(flutter::Shell::OnEngineHandlePlatformMessage(fml::RefPtr<flutter::PlatformMessage>)::$_31&&&) type_traits:4350
    #9 0x10c74493a in void std::__1::__invoke_void_return_wrapper<void>::__call<flutter::Shell::OnEngineHandlePlatformMessage(fml::RefPtr<flutter::PlatformMessage>)::$_31&>(flutter::Shell::OnEngineHandlePlatformMessage(fml::RefPtr<flutter::PlatformMessage>)::$_31&&&) __functional_base:349
    #10 0x10c740ee1 in std::__1::__function::__func<flutter::Shell::OnEngineHandlePlatformMessage(fml::RefPtr<flutter::PlatformMessage>)::$_31, std::__1::allocator<flutter::Shell::OnEngineHandlePlatformMessage(fml::RefPtr<flutter::PlatformMessage>)::$_31>, void ()>::operator()() functional:1572
    #11 0x108dab03b in std::__1::function<void ()>::operator()() const functional:1923
    #12 0x10a52bf03 in fml::MessageLoopImpl::FlushTasks(fml::FlushType) message_loop_impl.cc:121
    #13 0x10a52ba17 in fml::MessageLoopImpl::RunExpiredTasksNow() message_loop_impl.cc:131
    #14 0x10a576d22 in fml::MessageLoopDarwin::OnTimerFire(__CFRunLoopTimer*, fml::MessageLoopDarwin*) message_loop_darwin.mm:75
    #15 0x7fff5095305f in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ (CoreFoundation:x86_64h+0x5a05f)
    #16 0x7fff50952c0b in __CFRunLoopDoTimer (CoreFoundation:x86_64h+0x59c0b)
    #17 0x7fff50952751 in __CFRunLoopDoTimers (CoreFoundation:x86_64h+0x59751)
    #18 0x7fff50933961 in __CFRunLoopRun (CoreFoundation:x86_64h+0x3a961)
    #19 0x7fff50932ebd in CFRunLoopRunSpecific (CoreFoundation:x86_64h+0x39ebd)
    #20 0x10a57740a in fml::MessageLoopDarwin::Run() message_loop_darwin.mm:46
    #21 0x10a52b883 in fml::MessageLoopImpl::DoRun() message_loop_impl.cc:90
    #22 0x10a52869a in fml::MessageLoop::Run() message_loop.cc:49
    #23 0x10a56c95a in fml::Thread::Thread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0::operator()() const thread.cc:34
    #24 0x10a56c6da in decltype(std::__1::forward<fml::Thread::Thread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0>(fp)()) std::__1::__invoke<fml::Thread::Thread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0>(fml::Thread::Thread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0&&) type_traits:4350
    #25 0x10a56c5d2 in void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, fml::Thread::Thread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, fml::Thread::Thread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0>&, std::__1::__tuple_indices<>) thread:342
    #26 0x10a56bc7b in void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, fml::Thread::Thread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0> >(void*) thread:352
    #27 0x7fff7ca9e2ea in _pthread_body (libsystem_pthread.dylib:x86_64+0x32ea)
    #28 0x7fff7caa1248 in _pthread_start (libsystem_pthread.dylib:x86_64+0x6248)
    #29 0x7fff7ca9d40c in thread_start (libsystem_pthread.dylib:x86_64+0x240c)

```