Release the mutex in the CanCreateConcurrentMessageLoop test before waking the latch (flutter/engine#43574)
If the wake happens while thread_ids_mutex is still held, then the test function may exit and destroy thread_ids_mutex before the pool thread task releases it. Fixes https://github.com/flutter/flutter/issues/130344
This commit is contained in:
@@ -331,8 +331,10 @@ TEST(MessageLoop, CanCreateConcurrentMessageLoop) {
|
||||
task_runner->PostTask([&]() {
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
std::cout << "Ran on thread: " << std::this_thread::get_id() << std::endl;
|
||||
std::scoped_lock lock(thread_ids_mutex);
|
||||
thread_ids.insert(std::this_thread::get_id());
|
||||
{
|
||||
std::scoped_lock lock(thread_ids_mutex);
|
||||
thread_ids.insert(std::this_thread::get_id());
|
||||
}
|
||||
latch.CountDown();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user