Skip to content

Commit

Permalink
[MA-225][DNO-95] remove message loop handlers when destroying VulkanS…
Browse files Browse the repository at this point in the history
…urfaceProducer to avoid callbacks on deleted pointers (flutter#3733)
  • Loading branch information
freiling authored Jun 2, 2017
1 parent bd09286 commit e954e2f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions content_handler/vulkan_rasterizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ VulkanRasterizer::VulkanSurfaceProducer::VulkanSurfaceProducer() {
FTL_LOG(ERROR) << "VulkanSurfaceProducer failed to initialize";
}

VulkanRasterizer::VulkanSurfaceProducer::~VulkanSurfaceProducer() {
for (auto &surface_info : pending_surfaces_)
mtl::MessageLoop::GetCurrent()->RemoveHandler(
surface_info.second.handler_key);
}

std::unique_ptr<VulkanRasterizer::VulkanSurfaceProducer::Surface>
VulkanRasterizer::VulkanSurfaceProducer::CreateSurface(uint32_t width,
uint32_t height) {
Expand Down
1 change: 1 addition & 0 deletions content_handler/vulkan_rasterizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class VulkanRasterizer : public Rasterizer {
private mtl::MessageLoopHandler {
public:
VulkanSurfaceProducer();
~VulkanSurfaceProducer() override;
sk_sp<SkSurface> ProduceSurface(SkISize size,
mozart::ImagePtr* out_image) override;

Expand Down

0 comments on commit e954e2f

Please sign in to comment.