[MA-225][DNO-95] remove message loop handlers when destroying VulkanSurfaceProducer to avoid callbacks on deleted pointers (#3733)

This commit is contained in:
freiling
2017-06-02 16:31:39 -07:00
committed by GitHub
parent bd09286e4a
commit e954e2f689
2 changed files with 7 additions and 0 deletions
+6
View File
@@ -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) {
+1
View File
@@ -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;