Retain a reference to the CFRunLoop until MessageLoopDarwin::Terminate exits (flutter/engine#34735)

This commit is contained in:
Jason Simmons 2022-07-19 09:56:06 -07:00 committed by GitHub
parent d3ff892b07
commit 23d5f04e7b

View File

@ -63,7 +63,12 @@ void MessageLoopDarwin::Run() {
void MessageLoopDarwin::Terminate() {
running_ = false;
CFRunLoopStop(loop_);
// Ensure that the CFRunLoop remains alive through the end of this function
// even if the loop's thread exits and drops its reference to the loop.
CFRef<CFRunLoopRef> local_loop(loop_);
CFRunLoopStop(local_loop);
}
void MessageLoopDarwin::WakeUp(fml::TimePoint time_point) {