Commit 055935fc authored by Peng Huang's avatar Peng Huang Committed by Commit Bot

SkiaOutputDeviceVulkan: fix a crash in Reshape()

The crash is because the VulkanSurface::Reshape() could be fail
for some reason, and then swap_chain_ in VulkanSurface could be
nullptr, accessing the nullptr swap_chain causes the crash.
Fix the problem by checking the return value of Reshape call of
VulkanSurface. If it returns false, VulkanSurface::Reshape() will
return false too. So the SkiaOutputSurfaceImplOnGpu will handle
it, and mark context lost.

TODO: investigate why reshape() fail with NVIDIA GPU.

Bug: 1062728
Change-Id: I3defd05466d98448599e5fc836ac229c2ce35b84
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2139938Reviewed-by: default avatarVasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757039}
parent 4f1e8b64
......@@ -71,7 +71,9 @@ bool SkiaOutputDeviceVulkan::Reshape(const gfx::Size& size,
return false;
auto generation = vulkan_surface_->swap_chain_generation();
vulkan_surface_->Reshape(size, transform);
if (!vulkan_surface_->Reshape(size, transform))
return false;
auto sk_color_space = color_space.ToSkColorSpace();
if (vulkan_surface_->swap_chain_generation() != generation ||
!SkColorSpace::Equals(sk_color_space.get(), sk_color_space_.get())) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment