Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use weak_ptrs for AppHost for coroutines #16065

Merged
merged 1 commit into from
Oct 3, 2023

Commits on Sep 29, 2023

  1. Use weak_ptrs for AppHost for coroutines

    See MSFT:46763065. Looks like we're in the middle of being `Refrigerate`d, we're
    pumping messages, and as we pump messages, we get to a `co_await` in
    `AppHost::_WindowInitializedHandler`. When we resume, we just try to use `this`
    like everything's fine but OH NO, IT'S NOT.
    
    To fix this, I'm
    * Adding `enable_shared_from_this` to `AppHost`
    * Holding the `AppHost` in a shared_ptr in WindowThread
      - though, this is a singular owning `shared_ptr`. This is probably ripe for
        other footguns, but there's little we can do about this.
    * whenever we `co_await` in `AppHost`, make sure we grab a weak ref first, and
      check it on the other side.
    
    This is another "squint and yep that's a bug" fix, that I haven't been able to
    verify locally. This is
    [allegedly](https://media.tenor.com/VQi3bktwLdIAAAAC/allegedly-supposedly.gif)
    about 10% of our 1.19 crashes after 3 days.
    
    Closes #16061
    zadjii-msft committed Sep 29, 2023
    Configuration menu
    Copy the full SHA
    8b6c7c2 View commit details
    Browse the repository at this point in the history