Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit a788d43

Browse files
committed
Reset Shell::weak_factory_gpu_ on the raster thread
weak_factory_gpu_ should only be accessed on the raster thread. If the Shell destructor running on the platform thread does a std::move of weak_factory_gpu_, then pending raster thread tasks may read it as null. Fixes internal bug b/166295661
1 parent 4bb6251 commit a788d43

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

shell/common/shell.cc

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -400,13 +400,12 @@ Shell::~Shell() {
400400

401401
fml::TaskRunner::RunNowOrPostTask(
402402
task_runners_.GetRasterTaskRunner(),
403-
fml::MakeCopyable([rasterizer = std::move(rasterizer_),
404-
weak_factory_gpu = std::move(weak_factory_gpu_),
405-
&gpu_latch]() mutable {
406-
rasterizer.reset();
407-
weak_factory_gpu.reset();
408-
gpu_latch.Signal();
409-
}));
403+
fml::MakeCopyable(
404+
[this, rasterizer = std::move(rasterizer_), &gpu_latch]() mutable {
405+
rasterizer.reset();
406+
this->weak_factory_gpu_.reset();
407+
gpu_latch.Signal();
408+
}));
410409
gpu_latch.Wait();
411410

412411
fml::TaskRunner::RunNowOrPostTask(

0 commit comments

Comments
 (0)