Fix potential null-point references (flutter/engine#37678)

This commit is contained in:
Kaushik Iska
2022-11-16 14:08:04 -08:00
committed by GitHub
parent adc79c3cf3
commit 5d5a04b2b3
4 changed files with 13 additions and 4 deletions

View File

@@ -129,7 +129,8 @@ std::shared_ptr<RenderPass> CommandBufferVK::OnCreateRenderPass(
}
std::shared_ptr<BlitPass> CommandBufferVK::OnCreateBlitPass() const {
FML_UNREACHABLE();
// TODO(kaushikiska): https://github.com/flutter/flutter/issues/112649
return nullptr;
}
std::shared_ptr<ComputePass> CommandBufferVK::OnCreateComputePass() const {

View File

@@ -179,20 +179,19 @@ sk_sp<DlImage> ImageDecoderImpeller::UploadTexture(
{
auto command_buffer = context->CreateCommandBuffer();
command_buffer->SetLabel("Mipmap Command Buffer");
if (!command_buffer) {
FML_DLOG(ERROR)
<< "Could not create command buffer for mipmap generation.";
return nullptr;
}
command_buffer->SetLabel("Mipmap Command Buffer");
auto blit_pass = command_buffer->CreateBlitPass();
blit_pass->SetLabel("Mipmap Blit Pass");
if (!blit_pass) {
FML_DLOG(ERROR) << "Could not create blit pass for mipmap generation.";
return nullptr;
}
blit_pass->SetLabel("Mipmap Blit Pass");
blit_pass->GenerateMipmap(texture);
blit_pass->EncodeCommands(context->GetResourceAllocator());
@@ -233,6 +232,7 @@ void ImageDecoderImpeller::Decode(fml::RefPtr<ImageDescriptor> descriptor,
io_runner = runners_.GetIOTaskRunner(), //
result //
]() {
FML_CHECK(context) << "No valid impeller context";
auto max_size_supported =
context->GetResourceAllocator()->GetMaxTextureSizeSupported();

View File

@@ -116,4 +116,9 @@ bool AndroidSurfaceVulkanImpeller::SetNativeWindow(
return false;
}
std::shared_ptr<impeller::Context>
AndroidSurfaceVulkanImpeller::GetImpellerContext() {
return impeller_context_;
}
} // namespace flutter

View File

@@ -40,6 +40,9 @@ class AndroidSurfaceVulkanImpeller : public AndroidSurface {
// |AndroidSurface|
bool ResourceContextClearCurrent() override;
// |AndroidSurface|
std::shared_ptr<impeller::Context> GetImpellerContext() override;
// |AndroidSurface|
bool SetNativeWindow(fml::RefPtr<AndroidNativeWindow> window) override;