You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix a case where a ReferenceCountedFutureImpl could be deallocated while running a user callback.
This could happen with an orphaned `RCFI` managed by a `FutureManager`. `FutureManager` relies on `RCFI::IsSafeToDelete()` to know whether it can destroy an orphaned instance; however, `IsSafeToDelete()` only considers whether there are any pending futures in flight. Thus, if no future is pending, it would return true if invoked while the `RCFI` is running the user callback associated with a recently-completed future. Destroying the `RCFI` instance would clean up the future that is passed to the user callback, making it invalid and likely leading the user callback to crash when `Future::result()` suddenly becomes null.
To fix this, track whether a user callback is currently running using a dedicated flag protected by the common mutex.
PiperOrigin-RevId: 263039541
0 commit comments